Class: RSpec::Mocks::ArgumentMatchers::ArrayIncludingMatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-mocks-3.12.2/lib/rspec/mocks/argument_matchers.rb

Instance Method Summary collapse

Constructor Details

#initialize(expected) ⇒ ArrayIncludingMatcher

Returns a new instance of ArrayIncludingMatcher.



233
234
235
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-mocks-3.12.2/lib/rspec/mocks/argument_matchers.rb', line 233

def initialize(expected)
  @expected = expected
end

Instance Method Details

#===(actual) ⇒ Object



237
238
239
240
241
242
243
244
245
246
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-mocks-3.12.2/lib/rspec/mocks/argument_matchers.rb', line 237

def ===(actual)
  actual = actual.uniq
  @expected.uniq.all? do |expected_element|
    actual.any? do |actual_element|
      RSpec::Support::FuzzyMatcher.values_match?(expected_element, actual_element)
    end
  end
rescue NoMethodError
  false
end

#descriptionObject



248
249
250
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-mocks-3.12.2/lib/rspec/mocks/argument_matchers.rb', line 248

def description
  "array_including(#{formatted_expected_values})"
end