forked from rails/rails
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[rails#52698] Add
TimeZoneConverter#==
method, so objects will be p…
…roperly... compared by their type, scale, limit & precision.
- Loading branch information
Showing
3 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
activerecord/test/cases/attribute_methods/time_zone_converter_test.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# frozen_string_literal: true | ||
|
||
require "cases/helper" | ||
require "active_support/core_ext/enumerable" | ||
|
||
module ActiveRecord | ||
module AttributeMethods | ||
module TimeZoneConversion | ||
class TimeZoneConverterTest < ActiveRecord::TestCase | ||
def test_comparison_with_date_time_type | ||
subtype = ActiveRecord::Type::DateTime.new | ||
value = ActiveRecord::AttributeMethods::TimeZoneConversion::TimeZoneConverter.new(subtype) | ||
value_from_cache = Marshal.load(Marshal.dump(value)) | ||
|
||
assert_equal value, value_from_cache | ||
end | ||
end | ||
end | ||
end | ||
end |