Class: Spec::Mocks::ArgumentMatchers::DuckTypeMatcher

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

Instance Method Summary collapse

Constructor Details

#initialize(*methods_to_respond_to) ⇒ DuckTypeMatcher

Returns a new instance of DuckTypeMatcher.



92
93
94
# File 'lib/spec/mocks/argument_matchers.rb', line 92

def initialize(*methods_to_respond_to)
  @methods_to_respond_to = methods_to_respond_to
end

Instance Method Details

#==(value) ⇒ Object



96
97
98
# File 'lib/spec/mocks/argument_matchers.rb', line 96

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