Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 55 lines (42 sloc) 1.354 kB
5d88142 @zenspider ! Hot damn! It works with ruby_parser!!! (phiggins)
zenspider authored
1 require 'minitest/autorun'
2 require 'heckle_runner'
3
4 # Tests needed:
5 # * if no method, loads all local methods
6 # * should raise an exception if the class/module can't be found
7 # * should raise an exception if the method can't be found
8 # * Tests for option parsing.
9
10 class TestHeckleRunnerRun < MiniTest::Unit::TestCase
11 @@dummy_dir = File.expand_path('test/fixtures/minitest_project')
12 dummy_lib = File.join(@@dummy_dir, 'lib')
13
14 $LOAD_PATH << dummy_lib
15
16 def setup
17 super
18
19 @old_pwd = Dir.pwd
20 Dir.chdir @@dummy_dir
21
22 # See MiniTest's test/minitest/metametameta.rb
23 @output = StringIO.new("")
24 MiniTest::Unit::TestCase.reset
25 MiniTest::Unit.output = @output
26 end
27
28 def teardown
29 super
30 Dir.chdir @old_pwd
31 MiniTest::Unit.output = $stdout
32
33 MiniTest::Unit::TestCase.test_suites.each do |test|
34 Object.send :remove_const, test.to_s.to_sym
35 end
36 end
37
38 def test_run_with_full_coverage
39 out, _ = capture_io do
40 HeckleRunner.run %w[Doubler double]
41 end
42
43 assert_match %r{No mutants survived.}, out
44 end
45
46 def test_run_with_partial_coverage
47 out, _ = capture_io do
48 HeckleRunner.run %w[Doubler double --tests test/test_doubler_with_a_number.rb]
49 end
50
51 assert_match %r{The following mutations didn't cause test failures:}, out
52 refute_match %{No mutants survived.}, out
53 end
54 end
Something went wrong with that request. Please try again.