2016-06-02 11:05:42 +05:30
|
|
|
|
require 'rails_helper'
|
|
|
|
|
|
|
|
|
|
feature 'Milestone', feature: true do
|
2016-09-29 09:46:39 +05:30
|
|
|
|
let(:project) { create(:empty_project, :public) }
|
2016-06-02 11:05:42 +05:30
|
|
|
|
let(:user) { create(:user) }
|
|
|
|
|
|
|
|
|
|
before do
|
|
|
|
|
project.team << [user, :master]
|
|
|
|
|
login_as(user)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
feature 'Create a milestone' do
|
2016-09-29 09:46:39 +05:30
|
|
|
|
scenario 'shows an informative message for a new milestone' do
|
2016-06-02 11:05:42 +05:30
|
|
|
|
visit new_namespace_project_milestone_path(project.namespace, project)
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
2016-06-02 11:05:42 +05:30
|
|
|
|
page.within '.milestone-form' do
|
|
|
|
|
fill_in "milestone_title", with: '8.7'
|
2017-08-17 22:00:37 +05:30
|
|
|
|
fill_in "milestone_start_date", with: '2016-11-16'
|
|
|
|
|
fill_in "milestone_due_date", with: '2016-12-16'
|
2016-06-02 11:05:42 +05:30
|
|
|
|
end
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
2016-06-02 11:05:42 +05:30
|
|
|
|
find('input[name="commit"]').click
|
|
|
|
|
|
|
|
|
|
expect(find('.alert-success')).to have_content('Assign some issues to this milestone.')
|
2017-08-17 22:00:37 +05:30
|
|
|
|
expect(page).to have_content('Nov 16, 2016–Dec 16, 2016')
|
2016-06-02 11:05:42 +05:30
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
feature 'Open a milestone with closed issues' do
|
2016-09-13 17:45:13 +05:30
|
|
|
|
scenario 'shows an informative message' do
|
2016-09-29 09:46:39 +05:30
|
|
|
|
milestone = create(:milestone, project: project, title: 8.7)
|
|
|
|
|
|
2016-06-02 11:05:42 +05:30
|
|
|
|
create(:issue, title: "Bugfix1", project: project, milestone: milestone, state: "closed")
|
|
|
|
|
visit namespace_project_milestone_path(project.namespace, project, milestone)
|
|
|
|
|
|
|
|
|
|
expect(find('.alert-success')).to have_content('All issues for this milestone are closed. You may close this milestone now.')
|
|
|
|
|
end
|
|
|
|
|
end
|
2016-09-29 09:46:39 +05:30
|
|
|
|
|
|
|
|
|
feature 'Open a milestone with an existing title' do
|
|
|
|
|
scenario 'displays validation message' do
|
|
|
|
|
milestone = create(:milestone, project: project, title: 8.7)
|
|
|
|
|
|
|
|
|
|
visit new_namespace_project_milestone_path(project.namespace, project)
|
|
|
|
|
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('Title has already been taken')
|
|
|
|
|
end
|
|
|
|
|
end
|
2016-06-02 11:05:42 +05:30
|
|
|
|
end
|