Class: Spec::Api::DuckTypeArgConstraint

Inherits:
Object
  • Object
show all
Defined in:
lib/spec/api/mocks/argument_expectation.rb

Instance Method Summary collapse

Constructor Details

#initialize(*methods_to_respond_do) ⇒ DuckTypeArgConstraint

Returns a new instance of DuckTypeArgConstraint.



53
54
55
# File 'lib/spec/api/mocks/argument_expectation.rb', line 53

def initialize(*methods_to_respond_do)
  @methods_to_respond_do = methods_to_respond_do
end

Instance Method Details

#matches?(value) ⇒ Boolean

Returns:

  • (Boolean)


57
58
59
# File 'lib/spec/api/mocks/argument_expectation.rb', line 57

def matches?(value)
  @methods_to_respond_do.all? { |sym| value.respond_to?(sym) }
end