aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorChris Salzberg <chris@dejimata.com>2017-12-15 21:22:41 +0900
committerChris Salzberg <chris@dejimata.com>2017-12-15 23:53:49 +0900
commitc91a44d5407a406ddd310f06a54327b1e3799e59 (patch)
treed96dd5f13f28c84f66d2d167a2cc432c192df070 /activerecord
parent9d43a84f73c1b3853a91d052a462ee60eccaf957 (diff)
downloadrails-c91a44d5407a406ddd310f06a54327b1e3799e59.tar.gz
rails-c91a44d5407a406ddd310f06a54327b1e3799e59.tar.bz2
rails-c91a44d5407a406ddd310f06a54327b1e3799e59.zip
Modify test to correctly pass attributes hash
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/test/cases/persistence_test.rb11
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