2016-04-26 07:22:52 -04:00
|
|
|
|
require 'rails_helper'
|
|
|
|
|
|
2017-06-29 00:13:10 -04:00
|
|
|
|
feature 'Milestone' do
|
2017-07-07 11:08:49 -04:00
|
|
|
|
let(:group) { create(:group, :public) }
|
2017-08-02 15:55:11 -04:00
|
|
|
|
let(:project) { create(:project, :public, namespace: group) }
|
2016-04-26 07:22:52 -04:00
|
|
|
|
let(:user) { create(:user) }
|
|
|
|
|
|
|
|
|
|
before do
|
2017-07-07 11:08:49 -04:00
|
|
|
|
create(:group_member, group: group, user: user)
|
2016-04-26 07:22:52 -04:00
|
|
|
|
project.team << [user, :master]
|
2017-06-21 19:44:10 -04:00
|
|
|
|
sign_in(user)
|
2016-04-26 07:22:52 -04:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
feature 'Create a milestone' do
|
2016-09-12 15:14:26 -04:00
|
|
|
|
scenario 'shows an informative message for a new milestone' do
|
2017-07-06 12:20:50 -04:00
|
|
|
|
visit new_project_milestone_path(project)
|
2016-11-15 12:48:30 -05:00
|
|
|
|
|
2016-04-26 07:22:52 -04:00
|
|
|
|
page.within '.milestone-form' do
|
|
|
|
|
fill_in "milestone_title", with: '8.7'
|
2016-11-15 12:48:30 -05:00
|
|
|
|
fill_in "milestone_start_date", with: '2016-11-16'
|
|
|
|
|
fill_in "milestone_due_date", with: '2016-12-16'
|
2016-04-26 07:22:52 -04:00
|
|
|
|
end
|
2016-11-15 12:48:30 -05:00
|
|
|
|
|
2016-04-26 07:22:52 -04:00
|
|
|
|
find('input[name="commit"]').click
|
|
|
|
|
|
|
|
|
|
expect(find('.alert-success')).to have_content('Assign some issues to this milestone.')
|
2017-02-24 12:07:29 -05:00
|
|
|
|
expect(page).to have_content('Nov 16, 2016–Dec 16, 2016')
|
2016-04-26 07:22:52 -04:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
feature 'Open a milestone with closed issues' do
|
2016-07-25 14:16:19 -04:00
|
|
|
|
scenario 'shows an informative message' do
|
2016-09-12 15:14:26 -04:00
|
|
|
|
milestone = create(:milestone, project: project, title: 8.7)
|
|
|
|
|
|
2016-04-26 07:22:52 -04:00
|
|
|
|
create(:issue, title: "Bugfix1", project: project, milestone: milestone, state: "closed")
|
2017-07-06 12:20:50 -04:00
|
|
|
|
visit project_milestone_path(project, milestone)
|
2016-04-26 07:22:52 -04:00
|
|
|
|
|
|
|
|
|
expect(find('.alert-success')).to have_content('All issues for this milestone are closed. You may close this milestone now.')
|
|
|
|
|
end
|
|
|
|
|
end
|
2016-09-12 15:14:26 -04:00
|
|
|
|
|
2017-07-07 11:08:49 -04:00
|
|
|
|
feature 'Open a project milestone with an existing title' do
|
|
|
|
|
scenario 'displays validation message when there is a project milestone with same title' do
|
2016-09-12 15:14:26 -04:00
|
|
|
|
milestone = create(:milestone, project: project, title: 8.7)
|
|
|
|
|
|
2017-07-06 12:20:50 -04:00
|
|
|
|
visit new_project_milestone_path(project)
|
2016-09-12 15:14:26 -04:00
|
|
|
|
page.within '.milestone-form' do
|
|
|
|
|
fill_in "milestone_title", with: milestone.title
|
|
|
|
|
end
|
|
|
|
|
find('input[name="commit"]').click
|
|
|
|
|
|
2017-07-07 11:08:49 -04:00
|
|
|
|
expect(find('.alert-danger')).to have_content('already being used for another group or project milestone.')
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
scenario 'displays validation message when there is a group milestone with same title' do
|
|
|
|
|
milestone = create(:milestone, project_id: nil, group: project.group, title: 8.7)
|
|
|
|
|
|
|
|
|
|
visit new_group_milestone_path(project.group)
|
|
|
|
|
|
|
|
|
|
page.within '.milestone-form' do
|
|
|
|
|
fill_in "milestone_title", with: milestone.title
|
|
|
|
|
end
|
|
|
|
|
find('input[name="commit"]').click
|
|
|
|
|
|
|
|
|
|
expect(find('.alert-danger')).to have_content('already being used for another group or project milestone.')
|
2016-09-12 15:14:26 -04:00
|
|
|
|
end
|
|
|
|
|
end
|
2016-04-26 07:22:52 -04:00
|
|
|
|
end
|