From 606bb58ca311ed48697588d053303bf5349abf01 Mon Sep 17 00:00:00 2001 From: Steve Kemp Date: Tue, 10 Mar 2015 09:24:18 +0000 Subject: 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. --- t/test-rubocop.rb | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 't') 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 -- cgit v1.2.1