Skip to content

Commit

Permalink
Do not blow up when something fails when running a directory
Browse files Browse the repository at this point in the history
  • Loading branch information
zamith committed May 2, 2015
1 parent dd28cce commit 2925e76
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/m/parser.rb
Expand Up @@ -28,8 +28,13 @@ def parse
t.test_files = FileList["#{testable.file}/*test*.rb", "#{testable.file}/*spec*.rb"]
end
# Invoke the rake task and exit, hopefully it'll work!
Rake::Task['m_custom'].invoke
exit
begin
Rake::Task['m_custom'].invoke
rescue RuntimeError
exit
ensure
exit
end
else
return testable
end
Expand Down
5 changes: 5 additions & 0 deletions test/everything_test.rb
Expand Up @@ -21,6 +21,11 @@ def test_running_tests_within_a_subdirectory
assert_output(/12 tests/, output)
end

def test_running_tests_with_failures_within_a_subdirectory
output = m('examples/subdir_with_failures')
assert_output(/1 tests, 1 assertions, 1 failures/, output)
end

def test_blank_file_is_quieter
output = m('bananas')
assert(/Valid tests to run/ !~ output)
Expand Down
7 changes: 7 additions & 0 deletions test/examples/subdir_with_failures/a_test.rb
@@ -0,0 +1,7 @@
require_relative '../../test_helper'

class ATest < MTest
def test_a
assert_equal 1, 2
end
end

0 comments on commit 2925e76

Please sign in to comment.