Sha256: 136694e7d239cf4de826d26241aecd24ee3ee1ab9b493ef612ed995694ec8898

Contents?: true

Size: 727 Bytes

Versions: 16

Compression:

Stored size: 727 Bytes

Contents

# frozen_string_literal: true

module RuboCop
  module Cop
    module Minitest
      # Checks if test class contains any test cases.
      #
      # @example
      #   # bad
      #   class FooTest < Minitest::Test
      #     def do_something
      #     end
      #   end
      #
      #   # good
      #   class FooTest < Minitest::Test
      #     def test_something
      #       assert true
      #     end
      #   end
      #
      class NoTestCases < Base
        include MinitestExplorationHelpers

        MSG = 'Test class should have test cases.'

        def on_class(node)
          return unless test_class?(node)

          add_offense(node) if test_cases(node).empty?
        end
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
rubocop-minitest-0.36.0 lib/rubocop/cop/minitest/no_test_cases.rb
rubocop-minitest-0.35.1 lib/rubocop/cop/minitest/no_test_cases.rb
rubocop-minitest-0.35.0 lib/rubocop/cop/minitest/no_test_cases.rb
rubocop-minitest-0.34.5 lib/rubocop/cop/minitest/no_test_cases.rb
rubocop-minitest-0.34.4 lib/rubocop/cop/minitest/no_test_cases.rb
rubocop-minitest-0.34.3 lib/rubocop/cop/minitest/no_test_cases.rb
rubocop-minitest-0.34.2 lib/rubocop/cop/minitest/no_test_cases.rb
rubocop-minitest-0.34.1 lib/rubocop/cop/minitest/no_test_cases.rb
rubocop-minitest-0.34.0 lib/rubocop/cop/minitest/no_test_cases.rb
rubocop-minitest-0.33.0 lib/rubocop/cop/minitest/no_test_cases.rb
rubocop-minitest-0.32.2 lib/rubocop/cop/minitest/no_test_cases.rb
rubocop-minitest-0.32.1 lib/rubocop/cop/minitest/no_test_cases.rb
rubocop-minitest-0.32.0 lib/rubocop/cop/minitest/no_test_cases.rb
rubocop-minitest-0.31.1 lib/rubocop/cop/minitest/no_test_cases.rb
rubocop-minitest-0.31.0 lib/rubocop/cop/minitest/no_test_cases.rb
rubocop-minitest-0.30.0 lib/rubocop/cop/minitest/no_test_cases.rb