1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/activerecord/test/cases/suppressor_test.rb
Rafael Mendonça França e28721baf2 Copy edit the suppressor documentation
[ci skip]
2015-02-19 09:08:51 -02:00

21 lines
581 B
Ruby

require 'cases/helper'
require 'models/notification'
require 'models/user'
class SuppressorTest < ActiveRecord::TestCase
def test_suppresses_creation_of_record_generated_by_callback
assert_difference -> { User.count } do
assert_no_difference -> { Notification.count } do
Notification.suppress { UserWithNotification.create! }
end
end
end
def test_resumes_saving_after_suppression_complete
Notification.suppress { UserWithNotification.create! }
assert_difference -> { Notification.count } do
Notification.create!
end
end
end