Class: Stendhal::Matchers::Equality

Inherits:
AbstractMatcher show all
Defined in:
lib/stendhal/matchers/equality.rb

Instance Attribute Summary

Attributes inherited from AbstractMatcher

#target

Instance Method Summary collapse

Methods inherited from AbstractMatcher

#initialize

Constructor Details

This class inherits a constructor from Stendhal::Matchers::AbstractMatcher

Instance Method Details

#match(original, options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/stendhal/matchers/equality.rb', line 5

def match(original, options = {})
  message = "expected #{original.inspect} #{options[:negative] ? 'to be different than' : 'to equal'} #{@target.inspect}"
  if options[:negative]
    raise Stendhal::Exceptions::ExpectationNotMet.new(message) if @target == original
  else
    raise Stendhal::Exceptions::ExpectationNotMet.new(message) unless @target == original
  end
  true
end