From f41feb349caed7580ba0493e3bb2e393cdb45ddb Mon Sep 17 00:00:00 2001 From: Michael Koziarski Date: Sat, 14 Jan 2006 08:26:20 +0000 Subject: Don't alter the Hash passed to attributes=, closes #3385 git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3417 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activerecord/test/base_test.rb | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'activerecord/test/base_test.rb') diff --git a/activerecord/test/base_test.rb b/activerecord/test/base_test.rb index 9b5d053a98..4de720a176 100755 --- a/activerecord/test/base_test.rb +++ b/activerecord/test/base_test.rb @@ -133,8 +133,19 @@ class BasicsTest < Test::Unit::TestCase topic = Topic.new topic.title = "New Topic" topic.save - topicReloaded = Topic.find(topic.id) - assert_equal("New Topic", topicReloaded.title) + topic_reloaded = Topic.find(topic.id) + assert_equal("New Topic", topic_reloaded.title) + end + + def test_hashes_not_mangled + new_topic = { :title => "New Topic" } + new_topic_values = { :title => "AnotherTopic" } + + topic = Topic.new(new_topic) + assert_equal new_topic[:title], topic.title + + topic.attributes= new_topic_values + assert_equal new_topic_value[:title], topic.title end def test_create_many -- cgit v1.2.3