summaryrefslogtreecommitdiff
path: root/spec/lib/constraints/group_url_constrainer_spec.rb
blob: 42299b17c2bc471edb8146f4d53712fba2f1115b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
require 'spec_helper'

describe GroupUrlConstrainer, lib: true do
  let!(:group) { create(:group, path: 'gitlab') }

  describe '#matches?' do
    context 'root group' do
      it { expect(subject.matches?(request '/gitlab')).to be_truthy }
      it { expect(subject.matches?(request '/gitlab.atom')).to be_truthy }
      it { expect(subject.matches?(request '/gitlab/edit')).to be_falsey }
      it { expect(subject.matches?(request '/gitlab-ce')).to be_falsey }
      it { expect(subject.matches?(request '/.gitlab')).to be_falsey }
    end
  end

  def request(path)
    double(:request, path: path)
  end
end