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)



219
220
221
# File 'lib/rspec/mocks/argument_matchers.rb', line 219

def initialize(*methods_to_respond_to)
  @methods_to_respond_to = methods_to_respond_to
end

Instance Method Details

- (Object) ===(value)



223
224
225
# File 'lib/rspec/mocks/argument_matchers.rb', line 223

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

- (Object) description



227
228
229
# File 'lib/rspec/mocks/argument_matchers.rb', line 227

def description
  "duck_type(#{@methods_to_respond_to.map(&:inspect).join(', ')})"
end