diff options
author | Stan Hu <stanhu@gmail.com> | 2015-10-06 09:57:13 -0700 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2015-10-07 07:21:50 -0700 |
commit | dfbbc80611fbdafe6f5ed809f98fc63987d104a6 (patch) | |
tree | 00a5f131e4b54c14162fc2a89cc2cca1a73512c9 /spec/finders | |
parent | cc8c91a1183ebfc5bb252f5e7f3f09fc20546476 (diff) | |
download | gitlab-ce-dfbbc80611fbdafe6f5ed809f98fc63987d104a6.tar.gz |
Support filtering by "Any" milestone or issue and fix "No Milestone" and "No Label" filters
Closes #2619
Closes https://github.com/gitlabhq/gitlabhq/issues/9631
Diffstat (limited to 'spec/finders')
-rw-r--r-- | spec/finders/issues_finder_spec.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/finders/issues_finder_spec.rb b/spec/finders/issues_finder_spec.rb index db20b23f87d..b1648055462 100644 --- a/spec/finders/issues_finder_spec.rb +++ b/spec/finders/issues_finder_spec.rb @@ -6,9 +6,11 @@ describe IssuesFinder do let(:project1) { create(:project) } let(:project2) { create(:project) } let(:milestone) { create(:milestone, project: project1) } + let(:label) { create(:label, project: project2) } let(:issue1) { create(:issue, author: user, assignee: user, project: project1, milestone: milestone) } let(:issue2) { create(:issue, author: user, assignee: user, project: project2) } let(:issue3) { create(:issue, author: user2, assignee: user2, project: project2) } + let!(:label_link) { create(:label_link, label: label, target: issue2) } before do project1.team << [user, :master] @@ -48,6 +50,24 @@ describe IssuesFinder do expect(issues).to eq([issue1]) end + it 'should filter by no milestone id' do + params = { scope: "all", milestone_title: Milestone::None.title, state: 'opened' } + issues = IssuesFinder.new(user, params).execute + expect(issues).to match_array([issue2, issue3]) + end + + it 'should filter by label name' do + params = { scope: "all", label_name: label.title, state: 'opened' } + issues = IssuesFinder.new(user, params).execute + expect(issues).to eq([issue2]) + end + + it 'should filter by no label name' do + params = { scope: "all", label_name: Label::None.title, state: 'opened' } + issues = IssuesFinder.new(user, params).execute + expect(issues).to match_array([issue1, issue3]) + end + it 'should be empty for unauthorized user' do params = { scope: "all", state: 'opened' } issues = IssuesFinder.new(nil, params).execute |