gitlab-org--gitlab-foss/spec/lib/constraints/user_url_constrainer_spec.rb
Dmitriy Zaporozhets 6683fdcfb0
Add nested groups support to the routing
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2016-11-23 14:08:36 +02:00

23 lines
541 B
Ruby

require 'spec_helper'
describe UserUrlConstrainer, lib: true do
let!(:user) { create(:user, username: 'dz') }
describe '#matches?' do
context 'valid request' do
let(:request) { build_request(user.username) }
it { expect(subject.matches?(request)).to be_truthy }
end
context 'invalid request' do
let(:request) { build_request('foo') }
it { expect(subject.matches?(request)).to be_falsey }
end
end
def build_request(username)
double(:request, params: { username: username })
end
end