diff options
author | Steve Kemp <steve@steve.org.uk> | 2015-03-10 09:24:18 +0000 |
---|---|---|
committer | Steve Kemp <steve@steve.org.uk> | 2015-03-10 09:24:18 +0000 |
commit | d84a072084db4a0284040776f005696a8fd4dce0 (patch) | |
tree | 7b7578d206852bac36f3f71db40583794ed0157a | |
parent | bc5dedf54e26a694c02c525a0e2e069e62568806 (diff) |
Correctly skip the rubocop testing if the gem is missing.
We now use the Test::Unit::TestCase.skip() method if the
gem is missing, rather than kill the whole suite.
-rwxr-xr-x | t/test-rubocop.rb | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/t/test-rubocop.rb b/t/test-rubocop.rb index e44ea14..f4a7612 100755 --- a/t/test-rubocop.rb +++ b/t/test-rubocop.rb @@ -4,16 +4,8 @@ require 'test/unit' # -# Skip this test if we cannot load the gem. +# This test is skipped if we cannot load the rubocop-gem. # -begin - require 'rubocop' -rescue LoadError => ex - puts "Failed to load 'rubocop' gem - skipping" - exit(0) -end - - class TestRubocop < Test::Unit::TestCase def setup @@ -23,9 +15,16 @@ class TestRubocop < Test::Unit::TestCase end def test_code - cli = RuboCop::CLI.new - result = cli.run - assert(result == 0, 'No errors found') + begin + require 'rubocop' + + cli = RuboCop::CLI.new + result = cli.run + assert(result == 0, 'No errors found') + + rescue LoadError => ex + skip("Failed to load 'rubocop' gem - skipping") + end end end |