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 | 606bb58ca311ed48697588d053303bf5349abf01 (patch) | |
| tree | 284db3be0b1290a9b138cab0c880baffbb00788b /t | |
| parent | 2e86852d3bc31de6197a54d6e91bba4e46f4368a (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.
Diffstat (limited to 't')
| -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  | 
