class Minitest::MustWonted::Matcher::Magick

The Magick ‘be_smth` matcher

Public Class Methods

new(name, args) click to toggle source
# 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

Public Instance Methods

match?(subject, wont) click to toggle source
# 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