Skip to content

Commit

Permalink
Get everything to work with stdlib minitest.
Browse files Browse the repository at this point in the history
  • Loading branch information
phiggins committed Sep 19, 2012
1 parent 6e8f336 commit 9ee1ef6
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
2 changes: 0 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,12 @@ Hoe.spec 'heckle' do
dependency 'ruby_parser', '~> 2.3.1'
dependency 'ruby2ruby', '~> 1.3.0'
dependency 'ZenTest', '~> 4.7.0'
extra_dev_deps << ['minitest', '~> 2.3.0']

multiruby_skip << "1.9" << "trunk"

self.test_globs = ["test/test_*.rb"]

self.testlib = :minitest
self.test_prelude = 'gem "minitest"'
end

# vim: syntax=ruby
12 changes: 6 additions & 6 deletions lib/heckle_runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ def self.parse_args argv
p options if options[:debug]

# TODO: Pass options to Heckle's initializer instead.
Heckle.debug = @options[:debug]
Heckle.timeout = @options[:timeout]
Heckle.debug = options[:debug]
Heckle.timeout = options[:timeout]

options
end
Expand All @@ -102,7 +102,7 @@ def initialize class_or_module, method, options={}
end

def run
Dir.glob(@options[:test_pattern]).each {|t| require File.expand_path(t) }
Dir.glob(@options[:test_pattern]).each {|t| load File.expand_path(t) }

MiniTestHeckler.new(@class_or_module, @method, @options[:nodes]).validate
end
Expand All @@ -116,11 +116,11 @@ def tests_pass?
silence do
MiniTest::Unit.runner = nil

result = MiniTest::Unit.new.run
MiniTest::Unit.new.run

p MiniTest::Unit.runner if Heckle.debug
runner = MiniTest::Unit.runner

result == 0
runner.failures == 0 && runner.errors == 0
end
end

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require "minitest/autorun"
require "doubler"

class TestDoubler < MiniTest::Unit::TestCase
class TestDoublerWithANumber < MiniTest::Unit::TestCase
def setup
@doubler = Doubler.new
end
Expand Down
5 changes: 4 additions & 1 deletion test/test_heckle_runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,17 @@ def setup
# See MiniTest's test/minitest/metametameta.rb
@output = StringIO.new("")
MiniTest::Unit::TestCase.reset
MiniTest::Unit.runner = nil
MiniTest::Unit.output = @output
end

def teardown
super
Dir.chdir @old_pwd
MiniTest::Unit.output = $stdout

MiniTest::Unit::TestCase.test_suites.each do |test|
Object.send :remove_const, test.to_s.to_sym
end
end

def test_run_with_full_coverage
Expand Down

0 comments on commit 9ee1ef6

Please sign in to comment.