summaryrefslogtreecommitdiff
path: root/spec/features/projects/issues/email_participants_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/features/projects/issues/email_participants_spec.rb')
-rw-r--r--spec/features/projects/issues/email_participants_spec.rb34
1 files changed, 34 insertions, 0 deletions
diff --git a/spec/features/projects/issues/email_participants_spec.rb b/spec/features/projects/issues/email_participants_spec.rb
new file mode 100644
index 00000000000..3ffe0a5ced8
--- /dev/null
+++ b/spec/features/projects/issues/email_participants_spec.rb
@@ -0,0 +1,34 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe 'viewing an issue', :js do
+ let_it_be(:user) { create(:user) }
+ let_it_be(:project) { create(:project, :public) }
+ let_it_be(:issue) { create(:issue, project: project) }
+ let_it_be(:note) { create(:note_on_issue, project: project, noteable: issue) }
+ let_it_be(:participants) { create_list(:issue_email_participant, 4, issue: issue) }
+
+ before do
+ sign_in(user)
+ visit project_issue_path(project, issue)
+ end
+
+ shared_examples 'email participants warning' do |selector|
+ it 'shows the correct message' do
+ expect(find(selector)).to have_content(", and 1 more will be notified of your comment")
+ end
+ end
+
+ context 'for a new note' do
+ it_behaves_like 'email participants warning', '.new-note'
+ end
+
+ context 'for a reply form' do
+ before do
+ find('.js-reply-button').click
+ end
+
+ it_behaves_like 'email participants warning', '.note-edit-form'
+ end
+end