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

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

Instance Method Summary collapse

Constructor Details

#initialize(*methods_to_respond_to) ⇒ DuckTypeConstraint

Returns a new instance of DuckTypeConstraint.



77
78
79
# File 'lib/gems/rspec-1.1.11/lib/spec/mocks/argument_constraints.rb', line 77

def initialize(*methods_to_respond_to)
  @methods_to_respond_to = methods_to_respond_to
end

Instance Method Details

#==(value) ⇒ Object



81
82
83
# File 'lib/gems/rspec-1.1.11/lib/spec/mocks/argument_constraints.rb', line 81

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