Tests: Remove defunct config: time_zone_aware_types

We started setting this config in rails 5, to preserve the behavior
in rails 4, ie. `time` columns being "zone-unaware".

If we rewrite our `time` column tests to focus on the time only
(and not the date) then we don't need to set time_zone_aware_types.
This commit is contained in:
Jared Beck 2020-12-14 17:07:58 -05:00
parent d9474bdc49
commit 31862462ce
2 changed files with 5 additions and 4 deletions

View File

@ -18,7 +18,6 @@ module Dummy
config.active_support.escape_html_entities_in_json = true
config.active_support.test_order = :sorted
config.secret_key_base = "A fox regularly kicked the screaming pile of biscuits."
config.active_record.time_zone_aware_types = [:datetime]
# In rails >= 6.0, "`.represent_boolean_as_integer=` is now always true,
# so setting this is deprecated and will be removed in Rails 6.1."

View File

@ -335,8 +335,9 @@ RSpec.describe(::PaperTrail, versioning: true) do
expect(previous_widget.a_datetime.to_time.utc.to_i).to(eq(t0.to_time.utc.to_i))
end
it "handle times" do
expect(previous_widget.a_time.utc.to_i).to(eq(t0.utc.to_i))
it "handle times (time only, no date)" do
format = ->(t) { t.utc.strftime "%H:%M:%S" }
expect(format[previous_widget.a_time]).to eq(format[t0])
end
it "handle dates" do
@ -362,7 +363,8 @@ RSpec.describe(::PaperTrail, versioning: true) do
assert_in_delta(153.01, reified.a_float, 0.001)
assert_in_delta(2.7183, reified.a_decimal, 0.0001)
expect(reified.a_datetime.to_time.utc.to_i).to(eq(t0.to_time.utc.to_i))
expect(reified.a_time.utc.to_i).to(eq(t0.utc.to_i))
format = ->(t) { t.utc.strftime "%H:%M:%S" }
expect(format[reified.a_time]).to eq(format[t0])
expect(reified.a_date).to(eq(d0))
expect(reified.a_boolean).to(be_truthy)
end