1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

adding a test for attributes after type cast. thanks nragaz. ❤️

This commit is contained in:
Aaron Patterson 2011-03-26 11:47:20 -07:00
parent cb3e96a447
commit dea3d2dd20

View file

@ -132,6 +132,23 @@ class AttributeMethodsTest < ActiveRecord::TestCase
end end
end end
def test_read_attributes_after_type_cast_on_datetime
in_time_zone "Pacific Time (US & Canada)" do
record = @target.new
record.written_on = "2011-03-24"
assert_equal "2011-03-24", record.written_on_before_type_cast
assert_equal Time.zone.parse("2011-03-24"), record.written_on
assert_equal ActiveSupport::TimeZone["Pacific Time (US & Canada)"],
record.written_on.time_zone
record.save
record.reload
assert_equal Time.zone.parse("2011-03-24"), record.written_on
end
end
def test_hash_content def test_hash_content
topic = Topic.new topic = Topic.new
topic.content = { "one" => 1, "two" => 2 } topic.content = { "one" => 1, "two" => 2 }