Sha256: 21ff7b500d6f1c62e8accd64ce2aee6fa74a21cbd7cf1515789478f2a3b4da2e

Contents?: true

Size: 1.11 KB

Versions: 4

Compression:

Stored size: 1.11 KB

Contents

begin
  require 'coveralls'
  Coveralls.wear_merged!
rescue LoadError
  warn "gem 'coveralls' not available, proceeding without it"
end

module Testable
  def m(arguments)
    Dir.chdir("test") do
      `ruby -I../lib  -I. ../bin/m #{arguments} 2>&1`.strip
    end
  end

  def assert_output(regexp, output)
    assert $?.success?, "Execution failed, output:\n\n#{output}"
    assert_match regexp, output
  end

  def assert_output_for_failed_execution(regexp, output)
    refute $?.success?, "Execution did not fail, but it should"
    assert_match regexp, output
  end
end

require 'm'

def try_loading(gem)
  begin
    require gem
  rescue LoadError
    return false
  end
end

try_loading('test-unit') ||
try_loading('minitest/autorun') ||
try_loading('test/unit')

if M::Frameworks.test_unit?
  begin
    require 'test-unit'
  rescue LoadError
    require('active_support/test_case')
  end

  class MTest < Test::Unit::TestCase
    include ::Testable
  end
elsif M::Frameworks.minitest5?
  class MTest < Minitest::Test
    include ::Testable
  end
else
  class MTest < MiniTest::Unit::TestCase
    include ::Testable
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
m-1.6.1 test/test_helper.rb
m-1.6.0 test/test_helper.rb
m-1.5.1 test/test_helper.rb
m-1.5.0 test/test_helper.rb