diff options
author | Rémy Coutable <remy@rymai.me> | 2017-08-01 21:03:07 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2018-01-18 17:07:57 +0300 |
commit | 799cd471099e032a60fbdb1ba6841e617f6c122f (patch) | |
tree | e18e25e7ec82f9fb35bad04890e57c21a69097af /spec/features/merge_requests/filter_by_milestone_spec.rb | |
parent | 50a649530a53a04d2044f9e4c5502586a7ed0c59 (diff) |
Improve MR feature specs and reduce duplication
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'spec/features/merge_requests/filter_by_milestone_spec.rb')
-rw-r--r-- | spec/features/merge_requests/filter_by_milestone_spec.rb | 97 |
1 files changed, 0 insertions, 97 deletions
diff --git a/spec/features/merge_requests/filter_by_milestone_spec.rb b/spec/features/merge_requests/filter_by_milestone_spec.rb deleted file mode 100644 index 8db94352f73..00000000000 --- a/spec/features/merge_requests/filter_by_milestone_spec.rb +++ /dev/null @@ -1,97 +0,0 @@ -require 'rails_helper' - -feature 'Merge Request filtering by Milestone' do - include FilteredSearchHelpers - include MergeRequestHelpers - - let(:project) { create(:project, :public, :repository) } - let!(:user) { create(:user)} - let(:milestone) { create(:milestone, project: project) } - - def filter_by_milestone(title) - find(".js-milestone-select").click - find(".milestone-filter a", text: title).click - end - - before do - project.add_master(user) - sign_in(user) - end - - scenario 'filters by no Milestone', :js do - create(:merge_request, :with_diffs, source_project: project) - create(:merge_request, :simple, source_project: project, milestone: milestone) - - visit_merge_requests(project) - input_filtered_search('milestone:none') - - expect_tokens([milestone_token('none', false)]) - expect_filtered_search_input_empty - - expect(page).to have_issuable_counts(open: 1, closed: 0, all: 1) - expect(page).to have_css('.merge-request', count: 1) - end - - context 'filters by upcoming milestone', :js do - it 'does not show merge requests with no expiry' do - create(:merge_request, :with_diffs, source_project: project) - create(:merge_request, :simple, source_project: project, milestone: milestone) - - visit_merge_requests(project) - input_filtered_search('milestone:upcoming') - - expect(page).to have_css('.merge-request', count: 0) - end - - it 'shows merge requests in future' do - milestone = create(:milestone, project: project, due_date: Date.tomorrow) - create(:merge_request, :with_diffs, source_project: project) - create(:merge_request, :simple, source_project: project, milestone: milestone) - - visit_merge_requests(project) - input_filtered_search('milestone:upcoming') - - expect(page).to have_issuable_counts(open: 1, closed: 0, all: 1) - expect(page).to have_css('.merge-request', count: 1) - end - - it 'does not show merge requests in past' do - milestone = create(:milestone, project: project, due_date: Date.yesterday) - create(:merge_request, :with_diffs, source_project: project) - create(:merge_request, :simple, source_project: project, milestone: milestone) - - visit_merge_requests(project) - input_filtered_search('milestone:upcoming') - - expect(page).to have_css('.merge-request', count: 0) - end - end - - scenario 'filters by a specific Milestone', :js do - create(:merge_request, :with_diffs, source_project: project, milestone: milestone) - create(:merge_request, :simple, source_project: project) - - visit_merge_requests(project) - input_filtered_search("milestone:%'#{milestone.title}'") - - expect(page).to have_issuable_counts(open: 1, closed: 0, all: 1) - expect(page).to have_css('.merge-request', count: 1) - end - - context 'when milestone has single quotes in title' do - background do - milestone.update(name: "rock 'n' roll") - end - - scenario 'filters by a specific Milestone', :js do - create(:merge_request, :with_diffs, source_project: project, milestone: milestone) - create(:merge_request, :simple, source_project: project) - - visit_merge_requests(project) - input_filtered_search("milestone:%\"#{milestone.title}\"") - - expect(page).to have_issuable_counts(open: 1, closed: 0, all: 1) - expect(page).to have_css('.merge-request', count: 1) - end - end -end |