Class: Spec::Mocks::ArgumentMatchers::HashNotIncludingMatcher

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

Instance Method Summary collapse

Constructor Details

#initialize(expected) ⇒ HashNotIncludingMatcher

Returns a new instance of HashNotIncludingMatcher.



77
78
79
# File 'lib/vendor/plugins/rspec/lib/spec/mocks/argument_matchers.rb', line 77

def initialize(expected)
  @expected = expected
end

Instance Method Details

#==(actual) ⇒ Object



81
82
83
84
85
86
87
88
# File 'lib/vendor/plugins/rspec/lib/spec/mocks/argument_matchers.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/vendor/plugins/rspec/lib/spec/mocks/argument_matchers.rb', line 90

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