Update test case for TZ aware attributes
The test added in 42418cfc94d1356d35d28d786f63e7fab9406ad6 wasn't actually testing anything, since the bug was with TZ aware attributes only.
This commit is contained in:
parent
42418cfc94
commit
65588b7463
@ -1,6 +1,8 @@
|
||||
require "cases/helper"
|
||||
|
||||
class PostgresqlInfinityTest < ActiveRecord::TestCase
|
||||
include InTimeZone
|
||||
|
||||
class PostgresqlInfinity < ActiveRecord::Base
|
||||
end
|
||||
|
||||
@ -42,9 +44,17 @@ class PostgresqlInfinity < ActiveRecord::Base
|
||||
assert_equal Float::INFINITY, record.datetime
|
||||
end
|
||||
|
||||
test "assigning 'infinity' on a datetime column" do
|
||||
record = PostgresqlInfinity.create!(datetime: "infinity")
|
||||
assert_equal Float::INFINITY, record.datetime
|
||||
assert_equal record.datetime, record.reload.datetime
|
||||
test "assigning 'infinity' on a datetime column with TZ aware attributes" do
|
||||
begin
|
||||
in_time_zone "Pacific Time (US & Canada)" do
|
||||
record = PostgresqlInfinity.create!(datetime: "infinity")
|
||||
assert_equal Float::INFINITY, record.datetime
|
||||
assert_equal record.datetime, record.reload.datetime
|
||||
end
|
||||
ensure
|
||||
# setting time_zone_aware_attributes causes the types to change.
|
||||
# There is no way to do this automatically since it can be set on a superclass
|
||||
PostgresqlInfinity.reset_column_information
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user