Class: Spec::Mocks::DuckTypeArgConstraint

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

Instance Method Summary collapse

Constructor Details

#initialize(*methods_to_respond_do) ⇒ DuckTypeArgConstraint

Returns a new instance of DuckTypeArgConstraint.



74
75
76
# File 'lib/spec/mocks/argument_expectation.rb', line 74

def initialize(*methods_to_respond_do)
  @methods_to_respond_do = methods_to_respond_do
end

Instance Method Details

#matches?(value) ⇒ Boolean

Returns:

  • (Boolean)


78
79
80
# File 'lib/spec/mocks/argument_expectation.rb', line 78

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