Class: Crspec::Mock::ArgumentMatchers::ArrayIncluding
- Inherits:
-
Object
- Object
- Crspec::Mock::ArgumentMatchers::ArrayIncluding
- Defined in:
- lib/crspec/mock/argument_matchers.rb
Instance Method Summary collapse
- #===(actual) ⇒ Object (also: #==)
-
#initialize(expected) ⇒ ArrayIncluding
constructor
A new instance of ArrayIncluding.
- #inspect ⇒ Object
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 |
#inspect ⇒ Object
56 |
# File 'lib/crspec/mock/argument_matchers.rb', line 56 def inspect = "array_including(#{@expected.inspect})" |