Class: Spec::Mocks::ArgumentConstraints::HashIncludingConstraint
- Defined in:
- lib/gems/rspec-1.1.12/lib/spec/mocks/argument_constraints.rb
Instance Method Summary collapse
- #==(actual) ⇒ Object
- #description ⇒ Object
-
#initialize(expected) ⇒ HashIncludingConstraint
constructor
A new instance of HashIncludingConstraint.
Constructor Details
#initialize(expected) ⇒ HashIncludingConstraint
Returns a new instance of HashIncludingConstraint.
58 59 60 |
# File 'lib/gems/rspec-1.1.12/lib/spec/mocks/argument_constraints.rb', line 58 def initialize(expected) @expected = expected end |
Instance Method Details
#==(actual) ⇒ Object
62 63 64 65 66 67 68 69 |
# File 'lib/gems/rspec-1.1.12/lib/spec/mocks/argument_constraints.rb', line 62 def ==(actual) @expected.each do | key, value | return false unless actual.has_key?(key) && value == actual[key] end true rescue NoMethodError => ex return false end |
#description ⇒ Object
71 72 73 |
# File 'lib/gems/rspec-1.1.12/lib/spec/mocks/argument_constraints.rb', line 71 def description "hash_including(#{@expected.inspect.sub(/^\{/,"").sub(/\}$/,"")})" end |