Class: ElabsMatchers::Matchers::ContainHash::ContainHashMatcher

Inherits:
Struct
  • Object
show all
Defined in:
lib/elabs_matchers/matchers/contain_hash.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#actualObject

Returns the value of attribute actual

Returns:

  • (Object)

    the current value of actual



6
7
8
# File 'lib/elabs_matchers/matchers/contain_hash.rb', line 6

def actual
  @actual
end

#expectedObject

Returns the value of attribute expected

Returns:

  • (Object)

    the current value of expected



6
7
8
# File 'lib/elabs_matchers/matchers/contain_hash.rb', line 6

def expected
  @expected
end

Instance Method Details

#failure_messageObject Also known as: failure_message_for_should



12
13
14
# File 'lib/elabs_matchers/matchers/contain_hash.rb', line 12

def failure_message
  "Expected #{expected.inspect} to exist in #{actual.inspect} but it did not."
end

#failure_message_when_negatedObject Also known as: failure_message_for_should_not



17
18
19
# File 'lib/elabs_matchers/matchers/contain_hash.rb', line 17

def failure_message_when_negated
  "Expected #{expected.inspect} to not exist in #{actual.inspect} but it did."
end

#matches?(actual) ⇒ Boolean

Returns:

  • (Boolean)


7
8
9
10
# File 'lib/elabs_matchers/matchers/contain_hash.rb', line 7

def matches?(actual)
  self.actual = actual
  contains?(expected, actual)
end