Skip to content

Commit

Permalink
[Matcher] Replace OpenStruct by Struct for better performances
Browse files Browse the repository at this point in the history
  • Loading branch information
Mth0158 committed Jul 29, 2024
1 parent 492f328 commit a7ed4e6
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/active_storage_validations/matchers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ def self.stub_method(object, method, result)
def self.mock_metadata(attachment, width, height)
if Rails.gem_version >= Gem::Version.new('6.0.0')
# Mock the Metadata class for rails 6
require 'ostruct'
mock = OpenStruct.new(metadata: { width: width, height: height })
mock = Struct.new(:metadata).new({ width: width, height: height })
stub_method(ActiveStorageValidations::Metadata, :new, mock) do
yield
end
Expand Down

0 comments on commit a7ed4e6

Please sign in to comment.