diff options
author | Santiago Pastorino <santiago@wyeworks.com> | 2011-07-25 07:20:38 -0700 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2011-07-25 07:20:38 -0700 |
commit | 64affc9384e9e8845b0204b94c003265442bc3e2 (patch) | |
tree | 3621b556f01e3ed95a20abd89cf8c469b186e382 /activerecord/test/cases/base_test.rb | |
parent | 14c0f0ee12f87970744e8373b996cb64d7ed37f7 (diff) | |
parent | f5e4d13270dbce2bb880ef6529da68aaee017910 (diff) | |
download | rails-64affc9384e9e8845b0204b94c003265442bc3e2.tar.gz rails-64affc9384e9e8845b0204b94c003265442bc3e2.tar.bz2 rails-64affc9384e9e8845b0204b94c003265442bc3e2.zip |
Merge pull request #2236 from cldwalker/after_initialize
Fix after_initialize and Base.create edge case
Diffstat (limited to 'activerecord/test/cases/base_test.rb')
-rw-r--r-- | activerecord/test/cases/base_test.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/activerecord/test/cases/base_test.rb b/activerecord/test/cases/base_test.rb index 8b4e7dd799..f2f5b73626 100644 --- a/activerecord/test/cases/base_test.rb +++ b/activerecord/test/cases/base_test.rb @@ -21,6 +21,7 @@ require 'models/parrot' require 'models/person' require 'models/edge' require 'models/joke' +require 'models/bulb' require 'rexml/document' require 'active_support/core_ext/exception' @@ -260,6 +261,18 @@ class BasicsTest < ActiveRecord::TestCase end end + def test_create_after_initialize_without_block + cb = CustomBulb.create(:name => 'Dude') + assert_equal('Dude', cb.name) + assert_equal(true, cb.frickinawesome) + end + + def test_create_after_initialize_with_block + cb = CustomBulb.create {|c| c.name = 'Dude' } + assert_equal('Dude', cb.name) + assert_equal(true, cb.frickinawesome) + end + def test_load topics = Topic.find(:all, :order => 'id') assert_equal(4, topics.size) |