summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2015-06-24 18:07:29 -0400
committerRobert Speicher <rspeicher@gmail.com>2015-07-06 22:39:55 -0400
commit3ee3cb24d44e8a9a1284fbd0944b9fcfb938c494 (patch)
tree044374f3ccb2799eec70c6759e5e0c719eed74c5 /spec
parentea565653a06125689cf30326bacfae812e1f2800 (diff)
downloadgitlab-ce-3ee3cb24d44e8a9a1284fbd0944b9fcfb938c494.tar.gz
Allow user to filter by Issues/Merge Requests without a Milestone
Diffstat (limited to 'spec')
-rw-r--r--spec/features/issues/filter_by_milestone_spec.rb38
-rw-r--r--spec/features/merge_requests/filter_by_milestone_spec.rb38
2 files changed, 76 insertions, 0 deletions
diff --git a/spec/features/issues/filter_by_milestone_spec.rb b/spec/features/issues/filter_by_milestone_spec.rb
new file mode 100644
index 00000000000..ad8adf4d372
--- /dev/null
+++ b/spec/features/issues/filter_by_milestone_spec.rb
@@ -0,0 +1,38 @@
+require 'spec_helper'
+
+feature 'Issue filtering by Milestone' do
+ include Select2Helper
+
+ let(:project) { create(:empty_project) }
+
+ before do
+ login_as(:admin)
+ end
+
+ scenario 'User filters by Issues without a Milestone', js: true do
+ create(:issue, project: project)
+
+ visit_issues
+ filter_by_milestone(NoMilestone.title)
+
+ expect(page).to have_css('.issue-title', count: 1)
+ end
+
+ scenario 'User filters by Issues with a specific Milestone', js: true do
+ milestone = create(:milestone, project: project)
+ create(:issue, project: project, milestone: milestone)
+
+ visit_issues
+ filter_by_milestone(milestone.title)
+
+ expect(page).to have_css('.issue-title', count: 1)
+ end
+
+ def visit_issues
+ visit namespace_project_issues_path(project.namespace, project)
+ end
+
+ def filter_by_milestone(title)
+ select2(title, from: '#milestone_title')
+ end
+end
diff --git a/spec/features/merge_requests/filter_by_milestone_spec.rb b/spec/features/merge_requests/filter_by_milestone_spec.rb
new file mode 100644
index 00000000000..56a9603f139
--- /dev/null
+++ b/spec/features/merge_requests/filter_by_milestone_spec.rb
@@ -0,0 +1,38 @@
+require 'spec_helper'
+
+feature 'Merge Request filtering by Milestone' do
+ include Select2Helper
+
+ let(:project) { create(:project) }
+
+ before do
+ login_as(:admin)
+ end
+
+ scenario 'User filters by Merge Requests without a Milestone', js: true do
+ create(:merge_request, :simple, source_project: project)
+
+ visit_merge_requests
+ filter_by_milestone(NoMilestone.title)
+
+ expect(page).to have_css('.merge-request-title', count: 1)
+ end
+
+ scenario 'User filters by Merge Requests with a specific Milestone', js: true do
+ milestone = create(:milestone, project: project)
+ create(:merge_request, :simple, source_project: project, milestone: milestone)
+
+ visit_merge_requests
+ filter_by_milestone(milestone.title)
+
+ expect(page).to have_css('.merge-request-title', count: 1)
+ end
+
+ def visit_merge_requests
+ visit namespace_project_merge_requests_path(project.namespace, project)
+ end
+
+ def filter_by_milestone(title)
+ select2(title, from: '#milestone_title')
+ end
+end