diff options
author | Nick Thomas <nick@gitlab.com> | 2016-08-16 17:08:43 +0100 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2016-08-16 17:08:43 +0100 |
commit | 0e9c4a902d7985d917fac1f833c9544133f83a95 (patch) | |
tree | aaca0b1902216b3d43973bf562d7d3eb01b1edb4 /spec/support/updating_mentions_shared_examples.rb | |
parent | b62954db4c40df435363994ce4632632fde01455 (diff) | |
download | gitlab-ce-0e9c4a902d7985d917fac1f833c9544133f83a95.tar.gz |
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.rb | 32 |
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 |