summaryrefslogtreecommitdiff
path: root/spec/finders
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-02-20 09:09:13 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-02-20 09:09:13 +0000
commit1ac794623a8be5dee111716a44dd04ff708f3541 (patch)
tree6c18f9fbe0bd9978bd3e8d9b083d3a0ca180686e /spec/finders
parent5247fe0bef72fa922841a79d5dbefb47d95112fa (diff)
downloadgitlab-ce-1ac794623a8be5dee111716a44dd04ff708f3541.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/finders')
-rw-r--r--spec/finders/fork_targets_finder_spec.rb35
1 files changed, 35 insertions, 0 deletions
diff --git a/spec/finders/fork_targets_finder_spec.rb b/spec/finders/fork_targets_finder_spec.rb
new file mode 100644
index 00000000000..e7110c33071
--- /dev/null
+++ b/spec/finders/fork_targets_finder_spec.rb
@@ -0,0 +1,35 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe ForkTargetsFinder do
+ subject(:finder) { described_class.new(project, user) }
+
+ let(:project) { create(:project, namespace: create(:group)) }
+ let(:user) { create(:user) }
+ let!(:maintained_group) do
+ create(:group).tap { |g| g.add_maintainer(user) }
+ end
+ let!(:owned_group) do
+ create(:group).tap { |g| g.add_owner(user) }
+ end
+ let!(:developer_group) do
+ create(:group).tap { |g| g.add_developer(user) }
+ end
+ let!(:reporter_group) do
+ create(:group).tap { |g| g.add_reporter(user) }
+ end
+ let!(:guest_group) do
+ create(:group).tap { |g| g.add_guest(user) }
+ end
+
+ before do
+ project.namespace.add_owner(user)
+ end
+
+ describe '#execute' do
+ it 'returns all user manageable namespaces except project namespace' do
+ expect(finder.execute).to match_array([user.namespace, maintained_group, owned_group])
+ end
+ end
+end