2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-09-06 10:50:21 +08:00

Refactors UserEmailObserver to improve Code Climate score

- Extracts certain logic to private methods and remove unnecessary
comments
- Extracts email enqueueing methods into a separate class
- Fix specs involving UserEmailObserver to call #after_commit instead
of the specific methods
This commit is contained in:
Ricardo Mendes 2013-08-24 12:21:39 +01:00
parent 1965cbcad6
commit 37f4022f73
3 changed files with 78 additions and 78 deletions

View file

@ -109,7 +109,7 @@ describe Notification do
describe '@mention' do
it "calls email_user_mentioned on creating a notification" do
UserEmailObserver.any_instance.expects(:email_user_mentioned).with(instance_of(Notification))
UserEmailObserver.any_instance.expects(:after_commit).with(instance_of(Notification))
Fabricate(:notification)
end
@ -117,7 +117,7 @@ describe Notification do
describe '@mention' do
it "calls email_user_quoted on creating a quote notification" do
UserEmailObserver.any_instance.expects(:email_user_quoted).with(instance_of(Notification))
UserEmailObserver.any_instance.expects(:after_commit).with(instance_of(Notification))
Fabricate(:quote_notification)
end
end