summaryrefslogtreecommitdiff
path: root/spec/lib/constraints/user_url_constrainer_spec.rb
blob: b3f8530c609793d20123cf113ce5ecb3a457ec6c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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