summaryrefslogtreecommitdiff
path: root/spec/features/milestone_spec.rb
diff options
context:
space:
mode:
authorMark Fletcher <mark@gitlab.com>2016-09-12 20:14:26 +0100
committerMark Fletcher <mark@gitlab.com>2016-09-19 09:29:12 +0100
commit58d02520b037255f9948de4386ab6cd970586445 (patch)
treec62987e9112f8ef40cb9772e72e73fd6b6a7f528 /spec/features/milestone_spec.rb
parent62516461d695c1e684529ab1fa807b86fb7f2ab2 (diff)
downloadgitlab-ce-58d02520b037255f9948de4386ab6cd970586445.tar.gz
Ensure validation messages are shown within the milestone form
* Remove call to Milestone#save! instead just Milestone#save * Add safety specs to stop a regression Fixes #22033
Diffstat (limited to 'spec/features/milestone_spec.rb')
-rw-r--r--spec/features/milestone_spec.rb21
1 files changed, 18 insertions, 3 deletions
diff --git a/spec/features/milestone_spec.rb b/spec/features/milestone_spec.rb
index c43661e5681..b8c838bf7ab 100644
--- a/spec/features/milestone_spec.rb
+++ b/spec/features/milestone_spec.rb
@@ -3,9 +3,8 @@ require 'rails_helper'
feature 'Milestone', feature: true do
include WaitForAjax
- let(:project) { create(:project, :public) }
+ let(:project) { create(:empty_project, :public) }
let(:user) { create(:user) }
- let(:milestone) { create(:milestone, project: project, title: 8.7) }
before do
project.team << [user, :master]
@@ -13,7 +12,7 @@ feature 'Milestone', feature: true do
end
feature 'Create a milestone' do
- scenario 'shows an informative message for a new issue' do
+ scenario 'shows an informative message for a new milestone' do
visit new_namespace_project_milestone_path(project.namespace, project)
page.within '.milestone-form' do
fill_in "milestone_title", with: '8.7'
@@ -26,10 +25,26 @@ feature 'Milestone', feature: true do
feature 'Open a milestone with closed issues' do
scenario 'shows an informative message' do
+ milestone = create(:milestone, project: project, title: 8.7)
+
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
+
+ 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
end