Class: Crspec::Mock::ArgumentMatchers::ArrayIncluding

Inherits:
Object
  • Object
show all
Defined in:
lib/crspec/mock/argument_matchers.rb

Instance Method Summary collapse

Constructor Details

#initialize(expected) ⇒ ArrayIncluding

Returns a new instance of ArrayIncluding.



45
46
47
# File 'lib/crspec/mock/argument_matchers.rb', line 45

def initialize(expected)
  @expected = expected
end

Instance Method Details

#===(actual) ⇒ Object Also known as: ==



49
50
51
52
53
# File 'lib/crspec/mock/argument_matchers.rb', line 49

def ===(actual)
  return false unless actual.is_a?(Array)

  @expected.all? { |item| actual.any? { |el| item == el || item === el } }
end

#inspectObject



56
# File 'lib/crspec/mock/argument_matchers.rb', line 56

def inspect = "array_including(#{@expected.inspect})"