summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorBob Van Landuyt <bob@gitlab.com>2017-03-08 20:16:17 +0100
committerBob Van Landuyt <bob@gitlab.com>2017-03-13 08:27:51 +0100
commit6f9304e03078acfa9c7afdceb1ed02e4c87265ca (patch)
tree8ecf9a1e166ada92b465d531f335e82596c713df /spec
parentf82115885d07e4eefec3594bdfc4bcd0210a1277 (diff)
downloadgitlab-ce-6f9304e03078acfa9c7afdceb1ed02e4c87265ca.tar.gz
Add a flash messages when an issue resolving discussions is created
Diffstat (limited to 'spec')
-rw-r--r--spec/controllers/projects/issues_controller_spec.rb14
-rw-r--r--spec/support/features/resolving_discussions_in_issues_shared_examples.rb10
2 files changed, 24 insertions, 0 deletions
diff --git a/spec/controllers/projects/issues_controller_spec.rb b/spec/controllers/projects/issues_controller_spec.rb
index 46e2f4cef29..70b1ae237ce 100644
--- a/spec/controllers/projects/issues_controller_spec.rb
+++ b/spec/controllers/projects/issues_controller_spec.rb
@@ -495,6 +495,20 @@ describe Projects::IssuesController do
expect(discussion.resolved?).to eq(true)
end
+ it 'sets a flash message' do
+ post_issue(title: 'Hello')
+
+ expect(flash[:notice]).to eq('Resolved 1 discussion.')
+ end
+
+ it 'pluralizes the flash message when resolving multiple discussions' do
+ create(:diff_note_on_merge_request, noteable: merge_request, project: project, line_number: 15)
+
+ post_issue(title: 'Hello')
+
+ expect(flash[:notice]).to eq('Resolved 2 discussions.')
+ end
+
it "resolves a single discussion" do
post_issue(other_params: { discussion_to_resolve: discussion.id })
discussion.first_note.reload
diff --git a/spec/support/features/resolving_discussions_in_issues_shared_examples.rb b/spec/support/features/resolving_discussions_in_issues_shared_examples.rb
index 669b306d94e..c8e5021d9a6 100644
--- a/spec/support/features/resolving_discussions_in_issues_shared_examples.rb
+++ b/spec/support/features/resolving_discussions_in_issues_shared_examples.rb
@@ -23,6 +23,16 @@ shared_examples 'creating an issue for a discussion' do
expect(discussion.resolved?).to eq(true)
end
+ it 'shows a flash messaage after resolving a discussion' do
+ click_button 'Submit issue'
+
+ page.within '.flash-notice' do
+ # Only check for the word 'Resolved' since the spec might have resolved
+ # multiple discussions
+ expect(page).to have_content('Resolved')
+ end
+ end
+
it 'has a hidden field for the merge request' do
merge_request_field = find('#merge_request_for_resolving_discussions', visible: false)