gitlab-org--gitlab-foss/spec/lib/constraints/user_url_constrainer_spec.rb
Dmitriy Zaporozhets 08d21fe899
Add small improvements to constrainers and specs
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2016-11-08 14:32:42 +02:00

16 lines
488 B
Ruby

require 'spec_helper'
describe UserUrlConstrainer, lib: true do
let!(:username) { create(:user, username: 'dz') }
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)
double(:request, path: path)
end
end