diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2017-12-16 00:49:51 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-16 00:49:51 +0900 |
commit | 6bd28902e2a11060562180241335a621d7e4b864 (patch) | |
tree | 099d9568db4652a25f55bf83cc7f3bbeaa7aa5eb /activerecord | |
parent | 311af752cfd98b534a3d5dbf30e4a202693f32dc (diff) | |
parent | c91a44d5407a406ddd310f06a54327b1e3799e59 (diff) | |
download | rails-6bd28902e2a11060562180241335a621d7e4b864.tar.gz rails-6bd28902e2a11060562180241335a621d7e4b864.tar.bz2 rails-6bd28902e2a11060562180241335a621d7e4b864.zip |
Merge pull request #31473 from shioyama/fix_instantiate_test_attributes
Modify test to correctly pass attributes hash
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/test/cases/persistence_test.rb | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/activerecord/test/cases/persistence_test.rb b/activerecord/test/cases/persistence_test.rb index 4cc66a2e49..c0b9a3ef76 100644 --- a/activerecord/test/cases/persistence_test.rb +++ b/activerecord/test/cases/persistence_test.rb @@ -353,12 +353,13 @@ class PersistenceTest < ActiveRecord::TestCase def test_create_columns_not_equal_attributes topic = Topic.instantiate( - "attributes" => { - "title" => "Another New Topic", - "does_not_exist" => "test" - } + "title" => "Another New Topic", + "does_not_exist" => "test" ) + topic = topic.dup # reset @new_record assert_nothing_raised { topic.save } + assert topic.persisted? + assert_equal "Another New Topic", topic.reload.title end def test_create_through_factory_with_block @@ -405,6 +406,8 @@ class PersistenceTest < ActiveRecord::TestCase topic_reloaded = Topic.instantiate(topic.attributes.merge("does_not_exist" => "test")) topic_reloaded.title = "A New Topic" assert_nothing_raised { topic_reloaded.save } + assert topic_reloaded.persisted? + assert_equal "A New Topic", topic_reloaded.reload.title end def test_update_for_record_with_only_primary_key |