Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2016-10-06 16:59:22 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2016-10-06 19:50:48 +0300
commit42c6555bab47eb042749be1f24d486797eb8d8ee (patch)
tree2931584b6ce06de3162f0b43aca5ceefd17a3f7c /spec/lib/constraints
parent105260314899303de4c70a1125b5ab69fb50e6d9 (diff)
Make user constrainer lookup same as controller and add more constrainer tests
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'spec/lib/constraints')
-rw-r--r--spec/lib/constraints/group_url_constrainer_spec.rb10
-rw-r--r--spec/lib/constraints/namespace_url_constrainer_spec.rb1
-rw-r--r--spec/lib/constraints/user_url_constrainer_spec.rb10
3 files changed, 20 insertions, 1 deletions
diff --git a/spec/lib/constraints/group_url_constrainer_spec.rb b/spec/lib/constraints/group_url_constrainer_spec.rb
new file mode 100644
index 00000000000..f0b75a664f2
--- /dev/null
+++ b/spec/lib/constraints/group_url_constrainer_spec.rb
@@ -0,0 +1,10 @@
+require 'spec_helper'
+
+describe GroupUrlConstrainer, lib: true do
+ let!(:username) { create(:group, path: 'gitlab-org') }
+
+ describe '#find_resource' do
+ it { expect(!!subject.find_resource('gitlab-org')).to be_truthy }
+ it { expect(!!subject.find_resource('gitlab-com')).to be_falsey }
+ end
+end
diff --git a/spec/lib/constraints/namespace_url_constrainer_spec.rb b/spec/lib/constraints/namespace_url_constrainer_spec.rb
index 8940fd6b94e..a5feaacb8ee 100644
--- a/spec/lib/constraints/namespace_url_constrainer_spec.rb
+++ b/spec/lib/constraints/namespace_url_constrainer_spec.rb
@@ -2,7 +2,6 @@ require 'spec_helper'
describe NamespaceUrlConstrainer, lib: true do
let!(:group) { create(:group, path: 'gitlab') }
- subject { NamespaceUrlConstrainer.new }
describe '#matches?' do
context 'existing namespace' do
diff --git a/spec/lib/constraints/user_url_constrainer_spec.rb b/spec/lib/constraints/user_url_constrainer_spec.rb
new file mode 100644
index 00000000000..4b26692672f
--- /dev/null
+++ b/spec/lib/constraints/user_url_constrainer_spec.rb
@@ -0,0 +1,10 @@
+require 'spec_helper'
+
+describe UserUrlConstrainer, lib: true do
+ let!(:username) { create(:user, username: 'dz') }
+
+ describe '#find_resource' do
+ it { expect(!!subject.find_resource('dz')).to be_truthy }
+ it { expect(!!subject.find_resource('john')).to be_falsey }
+ end
+end