Sha256: 87a19075d71f69dbf5b727f1d9311bf12c30f0c696415abf13291aa47a839811

Contents?: true

Size: 968 Bytes

Versions: 1

Compression:

Stored size: 968 Bytes

Contents

module MiniTest
  module Assertions
    def assert_must(subject, matcher, msg = nil)
      msg = message(msg) do
        if matcher.respond_to? :failure_message
          matcher.failure_message
        else
          "Expected #{subject.inspect} to #{matcher.description}"
        end
      end

      assert matcher.matches?(subject), msg
    end

    def assert_wont(subject, matcher, msg = nil)
      msg = message(msg) do
        if matcher.respond_to? :negative_failure_message
          matcher.negative_failure_message
        else
          "Expected not to #{matcher.description}"
        end
      end

      refute matcher.matches?(subject), msg
    end
  end

  module Expectations
    infect_an_assertion :assert_must, :must, :reverse
    infect_an_assertion :assert_wont, :wont, :reverse
  end
end

class MiniTest::Spec
  def must(*args, &block)
    subject.must(*args, &block)
  end

  def wont(*args, &block)
    subject.wont(*args, &block)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mongoid-minitest-0.0.1 lib/minitest/matchers.rb