Permalink
Browse files

Tighten tests for before/after update

  • Loading branch information...
jasoncodes committed May 16, 2010
1 parent 602649d commit 30791e8aa341663f3ebc75ee57f55b26b7d8011a
Showing with 10 additions and 0 deletions.
  1. +10 −0 test/after_commit_test.rb
View
@@ -105,10 +105,15 @@ def test_before_commit_on_create_is_called
def test_before_commit_on_update_is_called
record = MockRecord.create!
+ record.before_commit_on_update_called = false
record.save
assert_equal true, record.before_commit_on_update_called
end
+ def test_before_commit_on_update_is_not_called_for_create
+ assert_nil MockRecord.create!.before_commit_on_update_called
+ end
+
def test_before_commit_on_destroy_is_called
assert_equal true, MockRecord.create!.destroy.before_commit_on_destroy_called
end
@@ -119,10 +124,15 @@ def test_after_commit_on_create_is_called
def test_after_commit_on_update_is_called
record = MockRecord.create!
+ record.after_commit_on_update_called = false
record.save
assert_equal true, record.after_commit_on_update_called
end
+ def test_after_commit_on_update_is_not_called_for_create
+ assert_nil MockRecord.create!.after_commit_on_update_called
+ end
+
def test_after_commit_on_destroy_is_called
assert_equal true, MockRecord.create!.destroy.after_commit_on_destroy_called
end

0 comments on commit 30791e8

Please sign in to comment.