Class: RSpec::Mocks::ArgumentMatchers::DuckTypeMatcher

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

Instance Method Summary collapse

Constructor Details

#initialize(*methods_to_respond_to) ⇒ DuckTypeMatcher

Returns a new instance of DuckTypeMatcher.



87
88
89
# File 'lib/rspec/mocks/argument_matchers.rb', line 87

def initialize(*methods_to_respond_to)
  @methods_to_respond_to = methods_to_respond_to
end

Instance Method Details

#==(value) ⇒ Object



91
92
93
# File 'lib/rspec/mocks/argument_matchers.rb', line 91

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