Skip to content

Commit

Permalink
Test encoding for serialized values
Browse files Browse the repository at this point in the history
  • Loading branch information
ankane committed Jan 6, 2024
1 parent d749e1f commit f2dfc10
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/model_types_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,10 @@ def assert_attribute(attribute, value, format: nil, time_zone: false, check_nil:
if expected.is_a?(String)
assert_equal expected.encoding, user.send(attribute).encoding
assert_equal expected.encoding, user.send(attribute2).encoding
elsif expected.is_a?(Hash)
k = expected.key?("b") ? "b" : :b
assert_equal expected[k].encoding, user.send(attribute)[k].encoding
assert_equal expected[k].encoding, user.send(attribute2)[k].encoding
end

# time zone
Expand All @@ -579,6 +583,10 @@ def assert_attribute(attribute, value, format: nil, time_zone: false, check_nil:
if expected.is_a?(String)
assert_equal expected.encoding, user.send(attribute).encoding
assert_equal expected.encoding, user.send(attribute2).encoding
elsif expected.is_a?(Hash)
k = expected.key?("b") ? "b" : :b
assert_equal expected[k].encoding, user.send(attribute)[k].encoding
assert_equal expected[k].encoding, user.send(attribute2)[k].encoding
end

# time zone
Expand Down

0 comments on commit f2dfc10

Please sign in to comment.