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_to) ⇒ DuckTypeArgConstraint

Returns a new instance of DuckTypeArgConstraint.



99
100
101
# File 'lib/spec/mocks/argument_expectation.rb', line 99

def initialize(*methods_to_respond_to)
  @methods_to_respond_to = methods_to_respond_to
end

Instance Method Details

#descriptionObject



107
108
109
# File 'lib/spec/mocks/argument_expectation.rb', line 107

def description
  "duck_type"
end

#matches?(value) ⇒ Boolean

Returns:

  • (Boolean)


103
104
105
# File 'lib/spec/mocks/argument_expectation.rb', line 103

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