summaryrefslogtreecommitdiff
path: root/t/test-rubocop.rb
blob: cb597e8ba523d1d2c4a7056bf02ca87644a7a5d8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/ruby -rubygems

require 'test/unit'


#
# This test is skipped if we cannot load the rubocop-gem.
#
class TestRubocop < Test::Unit::TestCase

  def setup
  end

  def teardown
  end

  def test_code
    begin
      require 'rubocop'

      cli = RuboCop::CLI.new
      result = cli.run
      assert(result.zero?, 'No errors found')

    rescue LoadError => ex
      if methods.include?(:skip)
        skip("Failed to load 'rubocop' gem - skipping")
      else
        omit("Failed to load 'rubocop' gem - skipping")
      end
    end
  end

end