Skip to content

Commit 0385029

Browse files
committed
SerializedAttributeTest: use decorate_attribute
Followup: rails#51608
1 parent edbe467 commit 0385029

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

activerecord/test/cases/serialized_attribute_test.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -502,12 +502,13 @@ def test_decorated_type_with_decorator_block
502502
klass = Class.new(ActiveRecord::Base) do
503503
self.table_name = Topic.table_name
504504
store :content, coder: ActiveRecord::Coders::JSON
505-
attribute(:content, EncryptedType.new(subtype: Topic.attribute_types.fetch("content")))
505+
decorate_attributes([:content]) do |name, type|
506+
EncryptedType.new(subtype: type)
507+
end
506508
end
507509

508510
topic = klass.create!(content: { trial: true })
509-
510-
assert_equal({ trial: true }, topic.content)
511+
assert_equal({ "trial" => true }, topic.content)
511512
end
512513

513514
def test_mutation_detection_does_not_double_serialize

0 commit comments

Comments
 (0)