Sha256: a010953776bc3d948a447c5b46ee58739b74ae6d3b2662a705db3dd26b765b7d

Contents?: true

Size: 1.04 KB

Versions: 1

Compression:

Stored size: 1.04 KB

Contents

gem 'minitest', '>= 4.7'
require 'bogus'

module MiniTest::Assertions
  def assert_received(subject, method, args, message = nil)
    with_bogus_matcher_for(subject, method, args) do |matcher, result|
      assert(result, message || matcher.failure_message_for_should)
    end
  end

  def refute_received(subject, method, args, message = nil)
    with_bogus_matcher_for(subject, method, args) do |matcher, result|
      refute(result, message || matcher.failure_message_for_should_not)
    end
  end

  private

  def with_bogus_matcher_for(subject, method, args)
    matcher = Bogus.have_received.__send__(method, *args)
    result  = matcher.matches?(subject)
    yield matcher, result
  end
end

module Bogus::Minitest
  include Bogus::MockingDSL

  def before_setup
    super
    Bogus.clear
  end

  def after_teardown
    Bogus.ensure_all_expectations_satisfied!
    super
  end
end

class Minitest::Test
  include Bogus::Minitest
end if defined? Minitest::Test

class MiniTest::Unit::TestCase
  include Bogus::Minitest
end if defined? MiniTest::Unit::TestCase

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bogus-0.1.3 lib/bogus/minitest.rb