Fix weird test failure.
This commit is contained in:
parent
a567e6bec9
commit
6057e17ae7
|
@ -13,7 +13,10 @@ class Notification < ActiveRecord::Base
|
|||
.where('topics.id IS NULL OR topics.deleted_at IS NULL') }
|
||||
|
||||
after_commit :send_email
|
||||
after_commit :refresh_notification_count
|
||||
# This is super weird because the tests fail if we don't specify `on: :destroy`
|
||||
# TODO: Revert back to default in Rails 5
|
||||
after_commit :refresh_notification_count, on: :destroy
|
||||
after_commit :refresh_notification_count, on: [:create, :update]
|
||||
|
||||
def self.ensure_consistency!
|
||||
Notification.exec_sql("
|
||||
|
|
|
@ -133,7 +133,7 @@ describe Notification do
|
|||
|
||||
it 'updates the notification count on destroy' do
|
||||
Notification.any_instance.expects(:refresh_notification_count).returns(nil)
|
||||
notification.destroy
|
||||
notification.destroy!
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue