Permalink
Browse files

cleaning up typecast test a little

  • Loading branch information...
1 parent c9708ad commit 004fc1c6949a92c7e02fbaa889d17318461c9b71 @tenderlove tenderlove committed Mar 27, 2011
Showing with 8 additions and 6 deletions.
  1. +8 −6 activerecord/test/cases/attribute_methods_test.rb
@@ -137,16 +137,18 @@ def test_read_attributes_after_type_cast_on_datetime
in_time_zone tz 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[tz],
- record.written_on.time_zone
+ date_string = "2011-03-24"
+ time = Time.zone.parse date_string
+
+ record.written_on = date_string
+ assert_equal date_string, record.written_on_before_type_cast
+ assert_equal time, record.written_on
+ assert_equal ActiveSupport::TimeZone[tz], record.written_on.time_zone
record.save
record.reload
- assert_equal Time.zone.parse("2011-03-24"), record.written_on
+ assert_equal time, record.written_on
end
end

0 comments on commit 004fc1c

Please sign in to comment.