Class: RuboCop::TestCase

Inherits:
Minitest::Test
  • Object
show all
Includes:
Minitest::AssertOffense
Defined in:
lib/rubocop/test_case.rb

Overview

Base test case class for testing custom cops with Minitest.

See the documentation of RuboCop::Minitest::AssertOffense for details.

Examples:

Usage


class MyCopTest < RuboCop::TestCase
  def test_registers_offense
    assert_offense(<<~RUBY)
      bad_method
      ^^^^^^^^^^ Use `good_method` instead of `bad_method`.
    RUBY

    assert_correction(<<~RUBY)
      good_method
    RUBY
  end
end

Method Summary

Methods included from Minitest::AssertOffense

integrate_plugins!