Class: Minitest::MustWonted::Matcher::Magick
- Defined in:
- lib/minitest/mustwonted/matcher/magick.rb
Overview
The Magick ‘be_smth` matcher
Instance Method Summary collapse
-
#initialize(name, args) ⇒ Magick
constructor
A new instance of Magick.
- #match?(subject, wont) ⇒ Boolean
Constructor Details
#initialize(name, args) ⇒ Magick
Returns a new instance of Magick.
6 7 8 9 10 |
# File 'lib/minitest/mustwonted/matcher/magick.rb', line 6 def initialize(name, args) @name = name.slice(3, name.size) @name+= '?' if name[name.size - 1] != '?' @args = args end |
Instance Method Details
#match?(subject, wont) ⇒ Boolean
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/minitest/mustwonted/matcher/magick.rb', line 12 def match?(subject, wont) @name = 'is_a?' if @name == 'a?' || @name == 'an?' match = subject.send @name, *@args if wont ? match : !match raise Minitest::Assertion, "Expected #{subject.inspect} ##{ @name} to return: #{ wont ? "false" : "true" }\nbut instead have: #{match.inspect}" end end |