Class: Spec::Mocks::ArgumentConstraints::DuckTypeConstraint

Inherits:
Object
  • Object
show all
Defined in:
lib/gems/rspec-1.1.12/lib/spec/mocks/argument_constraints.rb

Instance Method Summary collapse

Constructor Details

#initialize(*methods_to_respond_to) ⇒ DuckTypeConstraint

Returns a new instance of DuckTypeConstraint.



96
97
98
# File 'lib/gems/rspec-1.1.12/lib/spec/mocks/argument_constraints.rb', line 96

def initialize(*methods_to_respond_to)
  @methods_to_respond_to = methods_to_respond_to
end

Instance Method Details

#==(value) ⇒ Object



100
101
102
# File 'lib/gems/rspec-1.1.12/lib/spec/mocks/argument_constraints.rb', line 100

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