Class: Stendhal::Matchers::Kind

Inherits:
AbstractMatcher show all
Defined in:
lib/stendhal/matchers/kind.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/kind.rb', line 5

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