diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-18 11:18:50 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-18 11:18:50 +0000 |
commit | 8c7f4e9d5f36cff46365a7f8c4b9c21578c1e781 (patch) | |
tree | a77e7fe7a93de11213032ed4ab1f33a3db51b738 /spec/helpers/search_helper_spec.rb | |
parent | 00b35af3db1abfe813a778f643dad221aad51fca (diff) | |
download | gitlab-ce-8c7f4e9d5f36cff46365a7f8c4b9c21578c1e781.tar.gz |
Add latest changes from gitlab-org/gitlab@13-1-stable-ee
Diffstat (limited to 'spec/helpers/search_helper_spec.rb')
-rw-r--r-- | spec/helpers/search_helper_spec.rb | 93 |
1 files changed, 0 insertions, 93 deletions
diff --git a/spec/helpers/search_helper_spec.rb b/spec/helpers/search_helper_spec.rb index 6a06b012c6c..b209ed869bf 100644 --- a/spec/helpers/search_helper_spec.rb +++ b/spec/helpers/search_helper_spec.rb @@ -8,99 +8,6 @@ describe SearchHelper do str end - describe 'search_autocomplete_opts' do - context "with no current user" do - before do - allow(self).to receive(:current_user).and_return(nil) - end - - it "returns nil" do - expect(search_autocomplete_opts("q")).to be_nil - end - end - - context "with a standard user" do - let(:user) { create(:user) } - - before do - allow(self).to receive(:current_user).and_return(user) - end - - it "includes Help sections" do - expect(search_autocomplete_opts("hel").size).to eq(9) - end - - it "includes default sections" do - expect(search_autocomplete_opts("dash").size).to eq(1) - end - - it "does not include admin sections" do - expect(search_autocomplete_opts("admin").size).to eq(0) - end - - it "does not allow regular expression in search term" do - expect(search_autocomplete_opts("(webhooks|api)").size).to eq(0) - end - - it "includes the user's groups" do - create(:group).add_owner(user) - expect(search_autocomplete_opts("gro").size).to eq(1) - end - - it "includes nested group" do - create(:group, :nested, name: 'foo').add_owner(user) - expect(search_autocomplete_opts('foo').size).to eq(1) - end - - it "includes the user's projects" do - project = create(:project, namespace: create(:namespace, owner: user)) - expect(search_autocomplete_opts(project.name).size).to eq(1) - end - - it "includes the required project attrs" do - project = create(:project, namespace: create(:namespace, owner: user)) - result = search_autocomplete_opts(project.name).first - - expect(result.keys).to match_array(%i[category id value label url avatar_url]) - end - - it "includes the required group attrs" do - create(:group).add_owner(user) - result = search_autocomplete_opts("gro").first - - expect(result.keys).to match_array(%i[category id label url avatar_url]) - end - - it "does not include the public group" do - group = create(:group) - expect(search_autocomplete_opts(group.name).size).to eq(0) - end - - context "with a current project" do - before do - @project = create(:project, :repository) - end - - it "includes project-specific sections" do - expect(search_autocomplete_opts("Files").size).to eq(1) - expect(search_autocomplete_opts("Commits").size).to eq(1) - end - end - end - - context 'with an admin user' do - let(:admin) { create(:admin) } - - before do - allow(self).to receive(:current_user).and_return(admin) - end - - it "includes admin sections" do - expect(search_autocomplete_opts("admin").size).to eq(1) - end - end - end - describe 'search_entries_info' do using RSpec::Parameterized::TableSyntax |