summaryrefslogtreecommitdiff
path: root/spec/finders
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-23 12:09:47 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-23 12:09:47 +0000
commit8f9beefac3774b30e911fb00a68f4c7a5244cf27 (patch)
tree919c3a043f8c10bc3f78f3f6e029acfb6b972556 /spec/finders
parente4bf776a8829e5186a0f63603c0be627b891d80e (diff)
downloadgitlab-ce-8f9beefac3774b30e911fb00a68f4c7a5244cf27.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/finders')
-rw-r--r--spec/finders/autocomplete/move_to_project_finder_spec.rb13
-rw-r--r--spec/finders/group_descendants_finder_spec.rb2
-rw-r--r--spec/finders/projects_finder_spec.rb18
3 files changed, 24 insertions, 9 deletions
diff --git a/spec/finders/autocomplete/move_to_project_finder_spec.rb b/spec/finders/autocomplete/move_to_project_finder_spec.rb
index f997dd32c40..9129a3b65be 100644
--- a/spec/finders/autocomplete/move_to_project_finder_spec.rb
+++ b/spec/finders/autocomplete/move_to_project_finder_spec.rb
@@ -3,8 +3,8 @@
require 'spec_helper'
describe Autocomplete::MoveToProjectFinder do
- let(:user) { create(:user) }
- let(:project) { create(:project) }
+ let_it_be(:user) { create(:user) }
+ let_it_be(:project) { create(:project) }
let(:no_access_project) { create(:project) }
let(:guest_project) { create(:project) }
@@ -92,6 +92,15 @@ describe Autocomplete::MoveToProjectFinder do
expect(described_class.new(user, project_id: project.id, search: 'wadus').execute.to_a)
.to eq([wadus_project])
end
+
+ it 'allows searching by parent namespace' do
+ group = create(:group)
+ other_project = create(:project, group: group)
+ other_project.add_maintainer(user)
+
+ expect(described_class.new(user, project_id: project.id, search: group.name).execute.to_a)
+ .to contain_exactly(other_project)
+ end
end
end
end
diff --git a/spec/finders/group_descendants_finder_spec.rb b/spec/finders/group_descendants_finder_spec.rb
index ee8606e474e..8d3564ca3c0 100644
--- a/spec/finders/group_descendants_finder_spec.rb
+++ b/spec/finders/group_descendants_finder_spec.rb
@@ -123,7 +123,7 @@ describe GroupDescendantsFinder do
project = create(:project, namespace: group)
other_project = create(:project)
other_project.project_group_links.create(group: group,
- group_access: ProjectGroupLink::MASTER)
+ group_access: ProjectGroupLink::MAINTAINER)
expect(finder.execute).to contain_exactly(project)
end
diff --git a/spec/finders/projects_finder_spec.rb b/spec/finders/projects_finder_spec.rb
index 6a04ca0eb67..eb3e28d1668 100644
--- a/spec/finders/projects_finder_spec.rb
+++ b/spec/finders/projects_finder_spec.rb
@@ -6,22 +6,22 @@ describe ProjectsFinder, :do_not_mock_admin_mode do
include AdminModeHelper
describe '#execute' do
- let(:user) { create(:user) }
- let(:group) { create(:group, :public) }
+ let_it_be(:user) { create(:user) }
+ let_it_be(:group) { create(:group, :public) }
- let!(:private_project) do
+ let_it_be(:private_project) do
create(:project, :private, name: 'A', path: 'A')
end
- let!(:internal_project) do
+ let_it_be(:internal_project) do
create(:project, :internal, group: group, name: 'B', path: 'B')
end
- let!(:public_project) do
+ let_it_be(:public_project) do
create(:project, :public, group: group, name: 'C', path: 'C')
end
- let!(:shared_project) do
+ let_it_be(:shared_project) do
create(:project, :private, name: 'D', path: 'D')
end
@@ -139,6 +139,12 @@ describe ProjectsFinder, :do_not_mock_admin_mode do
it { is_expected.to eq([public_project]) }
end
+ describe 'filter by group name' do
+ let(:params) { { name: group.name, search_namespaces: true } }
+
+ it { is_expected.to eq([public_project, internal_project]) }
+ end
+
describe 'filter by archived' do
let!(:archived_project) { create(:project, :public, :archived, name: 'E', path: 'E') }