Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Thomas <nick@gitlab.com>2016-08-16 19:08:43 +0300
committerNick Thomas <nick@gitlab.com>2016-08-16 19:08:43 +0300
commit0e9c4a902d7985d917fac1f833c9544133f83a95 (patch)
treeaaca0b1902216b3d43973bf562d7d3eb01b1edb4 /spec/support/updating_mentions_shared_examples.rb
parentb62954db4c40df435363994ce4632632fde01455 (diff)
DRY up the added update service specs, add two email helpers
Diffstat (limited to 'spec/support/updating_mentions_shared_examples.rb')
-rw-r--r--spec/support/updating_mentions_shared_examples.rb32
1 files changed, 32 insertions, 0 deletions
diff --git a/spec/support/updating_mentions_shared_examples.rb b/spec/support/updating_mentions_shared_examples.rb
new file mode 100644
index 00000000000..e0c59a5c280
--- /dev/null
+++ b/spec/support/updating_mentions_shared_examples.rb
@@ -0,0 +1,32 @@
+RSpec.shared_examples 'updating mentions' do |service_class|
+ let(:mentioned_user) { create(:user) }
+ let(:service_class) { service_class }
+
+ before { project.team << [mentioned_user, :developer] }
+
+ def update_mentionable(opts)
+ reset_delivered_emails!
+
+ perform_enqueued_jobs do
+ service_class.new(project, user, opts).execute(mentionable)
+ end
+
+ mentionable.reload
+ end
+
+ context 'in title' do
+ before { update_mentionable(title: mentioned_user.to_reference) }
+
+ it 'emails only the newly-mentioned user' do
+ should_only_email(mentioned_user)
+ end
+ end
+
+ context 'in description' do
+ before { update_mentionable(description: mentioned_user.to_reference) }
+
+ it 'emails only the newly-mentioned user' do
+ should_only_email(mentioned_user)
+ end
+ end
+end