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

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

Instance Method Summary (collapse)

Constructor Details

- (DuckTypeMatcher) initialize(*methods_to_respond_to)

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

- (Object) ==(value)



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