diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-21 02:50:22 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-21 02:50:22 +0300 |
commit | 9dc93a4519d9d5d7be48ff274127136236a3adb3 (patch) | |
tree | 70467ae3692a0e35e5ea56bcb803eb512a10bedb /spec/lib/gitlab/search_context | |
parent | 4b0f34b6d759d6299322b3a54453e930c6121ff0 (diff) |
Add latest changes from gitlab-org/gitlab@13-11-stable-eev13.11.0-rc43
Diffstat (limited to 'spec/lib/gitlab/search_context')
-rw-r--r-- | spec/lib/gitlab/search_context/builder_spec.rb | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/spec/lib/gitlab/search_context/builder_spec.rb b/spec/lib/gitlab/search_context/builder_spec.rb index 5b4190fc67e..079477115bb 100644 --- a/spec/lib/gitlab/search_context/builder_spec.rb +++ b/spec/lib/gitlab/search_context/builder_spec.rb @@ -127,6 +127,35 @@ RSpec.describe Gitlab::SearchContext::Builder, type: :controller do it { is_expected.to be_for_group } it { is_expected.to be_search_context(group: group) } + + context 'with group scope' do + let(:action_name) { '' } + + before do + allow(controller).to receive(:controller_name).and_return('groups') + allow(controller).to receive(:action_name).and_return(action_name) + end + + it 'returns nil without groups controller action' do + expect(subject.scope).to be(nil) + end + + context 'when on issues scope' do + let(:action_name) { 'issues' } + + it 'search context returns issues scope' do + expect(subject.scope).to be('issues') + end + end + + context 'when on merge requests scope' do + let(:action_name) { 'merge_requests' } + + it 'search context returns issues scope' do + expect(subject.scope).to be('merge_requests') + end + end + end end end |