Skip to content
Browse files

test case for #7853

  • Loading branch information...
1 parent 05e9258 commit 493d5a6a09bf526bfbf700b0f1ea917a5ebfffcd @senny committed Oct 6, 2012
Showing with 7 additions and 0 deletions.
  1. +7 −0 activerecord/test/cases/base_test.rb
View
7 activerecord/test/cases/base_test.rb
@@ -336,6 +336,13 @@ def test_first_or_create_bang
assert_equal parrot, the_same_parrot
end
+ def test_first_or_create_with_callbacks
+ # make sure, that the attribute is not set without the callback beeing run
+ assert_equal nil, Topic.new.written_on
+ topic = Topic.where(:title => 'new topic').first_or_create
+ assert_not_equal nil, topic.written_on
+ end
+
def test_first_or_initialize
parrot = Bird.first_or_initialize(:color => 'green', :name => 'parrot')
assert_kind_of Bird, parrot

0 comments on commit 493d5a6

Please sign in to comment.
Something went wrong with that request. Please try again.