2015-07-08 19:49:37 +00:00
|
|
|
require 'rails_helper'
|
2015-06-24 22:07:29 +00:00
|
|
|
|
2015-06-28 20:19:52 +00:00
|
|
|
feature 'Merge Request filtering by Milestone', feature: true do
|
2015-07-08 15:28:37 +00:00
|
|
|
let(:project) { create(:project, :public) }
|
|
|
|
let(:milestone) { create(:milestone, project: project) }
|
|
|
|
|
2015-07-08 19:49:37 +00:00
|
|
|
scenario 'filters by no Milestone', js: true do
|
|
|
|
create(:merge_request, :with_diffs, source_project: project)
|
2015-07-08 15:28:37 +00:00
|
|
|
create(:merge_request, :simple, source_project: project, milestone: milestone)
|
2015-06-24 22:07:29 +00:00
|
|
|
|
2015-07-08 19:49:37 +00:00
|
|
|
visit_merge_requests(project)
|
2015-06-28 20:12:32 +00:00
|
|
|
filter_by_milestone(Milestone::None.title)
|
2015-06-24 22:07:29 +00:00
|
|
|
|
2016-03-29 14:26:12 +00:00
|
|
|
expect(page).to have_css('.merge-request', count: 1)
|
2015-06-24 22:07:29 +00:00
|
|
|
end
|
|
|
|
|
2016-03-23 16:56:16 +00:00
|
|
|
context 'filters by upcoming milestone', js: true do
|
|
|
|
it 'should not show issues 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)
|
|
|
|
filter_by_milestone(Milestone::Upcoming.title)
|
|
|
|
|
2016-03-29 14:26:12 +00:00
|
|
|
expect(page).to have_css('.merge-request', count: 0)
|
2016-03-23 16:56:16 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'should show issues 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)
|
|
|
|
filter_by_milestone(Milestone::Upcoming.title)
|
|
|
|
|
2016-03-29 17:20:10 +00:00
|
|
|
expect(page).to have_css('.merge-request', count: 1)
|
2016-03-23 16:56:16 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'should not show issues 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)
|
|
|
|
filter_by_milestone(Milestone::Upcoming.title)
|
|
|
|
|
2016-03-29 17:20:10 +00:00
|
|
|
expect(page).to have_css('.merge-request', count: 0)
|
2016-03-23 16:56:16 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-07-08 19:49:37 +00:00
|
|
|
scenario 'filters by a specific Milestone', js: true do
|
|
|
|
create(:merge_request, :with_diffs, source_project: project, milestone: milestone)
|
2015-07-08 15:28:37 +00:00
|
|
|
create(:merge_request, :simple, source_project: project)
|
2015-06-24 22:07:29 +00:00
|
|
|
|
2015-07-08 19:49:37 +00:00
|
|
|
visit_merge_requests(project)
|
2015-06-24 22:07:29 +00:00
|
|
|
filter_by_milestone(milestone.title)
|
|
|
|
|
2016-03-29 17:20:10 +00:00
|
|
|
expect(page).to have_css('.merge-request', count: 1)
|
2015-06-24 22:07:29 +00:00
|
|
|
end
|
|
|
|
|
2015-07-08 19:49:37 +00:00
|
|
|
def visit_merge_requests(project)
|
2015-06-24 22:07:29 +00:00
|
|
|
visit namespace_project_merge_requests_path(project.namespace, project)
|
|
|
|
end
|
|
|
|
|
|
|
|
def filter_by_milestone(title)
|
2016-03-10 09:51:39 +00:00
|
|
|
find(".js-milestone-select").click
|
|
|
|
find(".milestone-filter a", text: title).click
|
2015-06-24 22:07:29 +00:00
|
|
|
end
|
|
|
|
end
|