diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-20 21:42:06 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-20 21:42:06 +0300 |
commit | 6e4e1050d9dba2b7b2523fdd1768823ab85feef4 (patch) | |
tree | 78be5963ec075d80116a932011d695dd33910b4e /spec/finders/issues_finder_spec.rb | |
parent | 1ce776de4ae122aba3f349c02c17cebeaa8ecf07 (diff) |
Add latest changes from gitlab-org/gitlab@13-3-stable-ee
Diffstat (limited to 'spec/finders/issues_finder_spec.rb')
-rw-r--r-- | spec/finders/issues_finder_spec.rb | 58 |
1 files changed, 55 insertions, 3 deletions
diff --git a/spec/finders/issues_finder_spec.rb b/spec/finders/issues_finder_spec.rb index 672318c292e..fb7d4e808fe 100644 --- a/spec/finders/issues_finder_spec.rb +++ b/spec/finders/issues_finder_spec.rb @@ -185,9 +185,9 @@ RSpec.describe IssuesFinder do let(:params) { { milestone_title: group_milestone.title } } before do - project2.update(namespace: group) - issue2.update(milestone: group_milestone) - issue3.update(milestone: group_milestone) + project2.update!(namespace: group) + issue2.update!(milestone: group_milestone) + issue3.update!(milestone: group_milestone) end it 'returns issues assigned to that group milestone' do @@ -668,6 +668,58 @@ RSpec.describe IssuesFinder do end end + context 'filtering by issue type' do + let_it_be(:incident_issue) { create(:incident, project: project1) } + + context 'no type given' do + let(:params) { { issue_types: [] } } + + it 'returns all issues' do + expect(issues).to contain_exactly(incident_issue, issue1, issue2, issue3, issue4) + end + end + + context 'incident type' do + let(:params) { { issue_types: ['incident'] } } + + it 'returns incident issues' do + expect(issues).to contain_exactly(incident_issue) + end + end + + context 'issue type' do + let(:params) { { issue_types: ['issue'] } } + + it 'returns all issues with type issue' do + expect(issues).to contain_exactly(issue1, issue2, issue3, issue4) + end + end + + context 'multiple params' do + let(:params) { { issue_types: %w(issue incident) } } + + it 'returns all issues' do + expect(issues).to contain_exactly(incident_issue, issue1, issue2, issue3, issue4) + end + end + + context 'without array' do + let(:params) { { issue_types: 'incident' } } + + it 'returns incident issues' do + expect(issues).to contain_exactly(incident_issue) + end + end + + context 'invalid params' do + let(:params) { { issue_types: ['nonsense'] } } + + it 'returns no issues' do + expect(issues).to eq(Issue.none) + end + end + end + context 'when the user is unauthorized' do let(:search_user) { nil } |