From c91a44d5407a406ddd310f06a54327b1e3799e59 Mon Sep 17 00:00:00 2001 From: Chris Salzberg Date: Fri, 15 Dec 2017 21:22:41 +0900 Subject: Modify test to correctly pass attributes hash --- activerecord/test/cases/persistence_test.rb | 11 +++++++---- 1 file 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 -- cgit v1.2.3