Fixed Base#write_attribute to work with both symbols and strings #1190 [Paul Legato]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1643 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
David Heinemeier Hansson
2005-07-03 09:51:24 +00:00
parent e24e2c41c2
commit aaa5637249
3 changed files with 12 additions and 1 deletions

View File

@@ -170,6 +170,15 @@ class BasicsTest < Test::Unit::TestCase
topicReloaded.send :write_attribute, 'does_not_exist', 'test'
assert_nothing_raised { topicReloaded.save }
end
def test_write_attribute
topic = Topic.new
topic.send(:write_attribute, :title, "Still another topic")
assert_equal "Still another topic", topic.title
topic.send(:write_attribute, "title", "Still another topic: part 2")
assert_equal "Still another topic: part 2", topic.title
end
def test_preserving_date_objects
# SQL Server doesn't have a separate column type just for dates, so all are returned as time