Class: Spec::Mocks::ArgumentConstraints::HashNotIncludingConstraint

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(expected) ⇒ HashNotIncludingConstraint

Returns a new instance of HashNotIncludingConstraint.



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

def initialize(expected)
  @expected = expected
end

Instance Method Details

#==(actual) ⇒ Object



81
82
83
84
85
86
87
88
# File 'lib/gems/rspec-1.1.12/lib/spec/mocks/argument_constraints.rb', line 81

def ==(actual)
  @expected.each do | key, value |
    return false if actual.has_key?(key) && value == actual[key]
  end
  true
rescue NoMethodError => ex
  return false
end

#descriptionObject



90
91
92
# File 'lib/gems/rspec-1.1.12/lib/spec/mocks/argument_constraints.rb', line 90

def description
  "hash_not_including(#{@expected.inspect.sub(/^\{/,"").sub(/\}$/,"")})"
end