Sha256: 5f368d2a95778cd8fe393a15e276bfb3b5dda9c13e7892a710e4a86bf098759a

Contents?: true

Size: 1.15 KB

Versions: 3

Compression:

Stored size: 1.15 KB

Contents

module EventMachine
  module Ventually
    class Eventually
      class MiniTest < Eventually
        def self.inject
          unless ::MiniTest::Unit::TestCase.public_method_defined?(:_em)
            ::MiniTest::Unit::TestCase.class_eval <<-EOT, __FILE__, __LINE__ + 1
            include EM::Ventually::Emify
            alias_method :__original__send__, :__send__
            old_warning_level = $VERBOSE
            $VERBOSE = nil
            def __send__(*args, &blk)
              if Callsite.parse(caller.first).method == 'run'
                _em { __original__send__(*args, &blk) }
              else
                __original__send__(*args, &blk)
              end
            end
            $VERBOSE = old_warning_level
            EOT
          end
        end

        def report(msg)
          @runner.assert false, msg
        end

        def assert_test(result)
          e = expectation
          if super
            msg = formatted_message("#{result.inspect} passed")
            @runner.instance_eval do
              assert true, msg
            end
            true
          else
            false
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
em-ventually-0.1.3 lib/em-ventually/eventually/minitest.rb
em-ventually-0.1.2 lib/em-ventually/eventually/minitest.rb
em-ventually-0.1.1 lib/em-ventually/eventually/minitest.rb