Class: RSpec::Mocks::ArgumentMatchers::HashNotIncludingMatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec/mocks/argument_matchers.rb

Instance Method Summary collapse

Constructor Details

#initialize(expected) ⇒ HashNotIncludingMatcher

Returns a new instance of HashNotIncludingMatcher.



73
74
75
# File 'lib/rspec/mocks/argument_matchers.rb', line 73

def initialize(expected)
  @expected = expected
end

Instance Method Details

#==(actual) ⇒ Object



77
78
79
80
81
82
83
84
# File 'lib/rspec/mocks/argument_matchers.rb', line 77

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



86
87
88
# File 'lib/rspec/mocks/argument_matchers.rb', line 86

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