2016-10-06 13:59:22 +00:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe UserUrlConstrainer, lib: true do
|
|
|
|
let!(:username) { create(:user, username: 'dz') }
|
|
|
|
|
2016-11-07 13:16:04 +00:00
|
|
|
describe '#matches?' do
|
|
|
|
it { expect(subject.matches?(request '/dz')).to be_truthy }
|
|
|
|
it { expect(subject.matches?(request '/dz.atom')).to be_truthy }
|
|
|
|
it { expect(subject.matches?(request '/dz/projects')).to be_falsey }
|
|
|
|
it { expect(subject.matches?(request '/gitlab')).to be_falsey }
|
|
|
|
end
|
|
|
|
|
|
|
|
def request(path)
|
2016-11-08 12:32:42 +00:00
|
|
|
double(:request, path: path)
|
2016-10-06 13:59:22 +00:00
|
|
|
end
|
|
|
|
end
|