Skip to content

Commit

Permalink
Merge pull request #51629 from Shopify/block-warning-fixes-2
Browse files Browse the repository at this point in the history
SerializedAttributeTest: use decorate_attribute
  • Loading branch information
rafaelfranca committed Apr 22, 2024
2 parents cc9d0b9 + 0385029 commit 271dab6
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions activerecord/test/cases/serialized_attribute_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -502,12 +502,13 @@ def test_decorated_type_with_decorator_block
klass = Class.new(ActiveRecord::Base) do
self.table_name = Topic.table_name
store :content, coder: ActiveRecord::Coders::JSON
attribute(:content, EncryptedType.new(subtype: Topic.attribute_types.fetch("content")))
decorate_attributes([:content]) do |name, type|
EncryptedType.new(subtype: type)
end
end

topic = klass.create!(content: { trial: true })

assert_equal({ trial: true }, topic.content)
assert_equal({ "trial" => true }, topic.content)
end

def test_mutation_detection_does_not_double_serialize
Expand Down

0 comments on commit 271dab6

Please sign in to comment.