From 8a6e9b934e6e25023437ff8a2dd2271d67a12e40 Mon Sep 17 00:00:00 2001 From: Nick Thomas Date: Tue, 16 Aug 2016 13:40:55 +0100 Subject: [PATCH] Address minor review comments for tests --- spec/services/issues/update_service_spec.rb | 6 +++--- .../merge_requests/update_service_spec.rb | 8 ++++---- spec/services/notification_service_spec.rb | 20 +++++++++---------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/spec/services/issues/update_service_spec.rb b/spec/services/issues/update_service_spec.rb index a5e375578ec..60561cc64d0 100644 --- a/spec/services/issues/update_service_spec.rb +++ b/spec/services/issues/update_service_spec.rb @@ -331,7 +331,7 @@ describe Issues::UpdateService, services: true do perform_enqueued_jobs { update_issue(title: user4.to_reference) } end - it "should email only the newly-mentioned user" do + it 'emails only the newly-mentioned user' do should_not_email(user) should_not_email(user2) should_not_email(user3) @@ -339,12 +339,12 @@ describe Issues::UpdateService, services: true do end end - context "in description" do + context 'in description' do before do perform_enqueued_jobs { update_issue(description: user4.to_reference) } end - it "should email only the newly-mentioned user" do + it 'emails only the newly-mentioned user' do should_not_email(user) should_not_email(user2) should_not_email(user3) diff --git a/spec/services/merge_requests/update_service_spec.rb b/spec/services/merge_requests/update_service_spec.rb index e26e925cd81..86d78f8c898 100644 --- a/spec/services/merge_requests/update_service_spec.rb +++ b/spec/services/merge_requests/update_service_spec.rb @@ -232,12 +232,12 @@ describe MergeRequests::UpdateService, services: true do project.team << [user4, :developer] end - context "in title" do + context 'in title' do before do perform_enqueued_jobs { update_merge_request(title: user4.to_reference) } end - it "should email only the newly-mentioned user" do + it 'emails only the newly-mentioned user' do should_not_email(user) should_not_email(user2) should_not_email(user3) @@ -245,12 +245,12 @@ describe MergeRequests::UpdateService, services: true do end end - context "in description" do + context 'in description' do before do perform_enqueued_jobs { update_merge_request(description: user4.to_reference) } end - it "should email only the newly-mentioned user" do + it 'emails only the newly-mentioned user' do should_not_email(user) should_not_email(user2) should_not_email(user3) diff --git a/spec/services/notification_service_spec.rb b/spec/services/notification_service_spec.rb index fbca28bbb17..1cf644e1331 100644 --- a/spec/services/notification_service_spec.rb +++ b/spec/services/notification_service_spec.rb @@ -405,12 +405,12 @@ describe NotificationService, services: true do notification.new_mentions_in_issue(issue, new_mentions, @u_disabled) end - it "should not email anyone unless they are newly mentioned" do + it 'sends no emails when no new mentions are present' do send_notifications - expect(ActionMailer::Base.deliveries).to eq [] + expect(ActionMailer::Base.deliveries).to be_empty end - it "should email new mentions with a watch level higher than participant" do + it 'emails new mentions with a watch level higher than participant' do send_notifications(@u_watcher, @u_participant_mentioned, @u_custom_global) should_email(@u_watcher) @@ -420,9 +420,9 @@ describe NotificationService, services: true do expect(ActionMailer::Base.deliveries.count).to eq 3 end - it "should not email new mentions with a watch level equal to or less than participant" do + it 'does not email new mentions with a watch level equal to or less than participant' do send_notifications(@u_participating, @u_mentioned) - expect(ActionMailer::Base.deliveries).to eq [] + expect(ActionMailer::Base.deliveries).to be_empty end end @@ -798,12 +798,12 @@ describe NotificationService, services: true do notification.new_mentions_in_merge_request(merge_request, new_mentions, @u_disabled) end - it "should not email anyone unless they are newly mentioned" do + it 'sends no emails when there are no new mentions' do send_notifications - expect(ActionMailer::Base.deliveries).to eq [] + expect(ActionMailer::Base.deliveries).to be_empty end - it "should email new mentions with a watch level higher than participant" do + it 'emails new mentions with a watch level higher than participant' do send_notifications(@u_watcher, @u_participant_mentioned, @u_custom_global) should_email(@u_watcher) @@ -813,9 +813,9 @@ describe NotificationService, services: true do expect(ActionMailer::Base.deliveries.count).to eq 3 end - it "should not email new mentions with a watch level equal to or less than participant" do + it 'does not email new mentions with a watch level equal to or less than participant' do send_notifications(@u_participating, @u_mentioned) - expect(ActionMailer::Base.deliveries).to eq [] + expect(ActionMailer::Base.deliveries).to be_empty end end