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-06-24 22:07:29 +00:00
|
|
|
include Select2Helper
|
|
|
|
|
2015-07-08 19:49:37 +00:00
|
|
|
scenario 'filters by no Milestone', js: true do
|
|
|
|
project = create(:project, :public)
|
|
|
|
create(:merge_request, :with_diffs, 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-28 20:12:32 +00:00
|
|
|
filter_by_milestone(Milestone::None.title)
|
2015-06-24 22:07:29 +00:00
|
|
|
|
|
|
|
expect(page).to have_css('.merge-request-title', count: 1)
|
|
|
|
end
|
|
|
|
|
2015-07-08 19:49:37 +00:00
|
|
|
scenario 'filters by a specific Milestone', js: true do
|
|
|
|
project = create(:project, :public)
|
2015-06-24 22:07:29 +00:00
|
|
|
milestone = create(:milestone, project: project)
|
2015-07-08 19:49:37 +00:00
|
|
|
create(:merge_request, :with_diffs, 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-24 22:07:29 +00:00
|
|
|
filter_by_milestone(milestone.title)
|
|
|
|
|
|
|
|
expect(page).to have_css('.merge-request-title', count: 1)
|
|
|
|
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)
|
|
|
|
select2(title, from: '#milestone_title')
|
|
|
|
end
|
|
|
|
end
|