class RuboCop::Cop::Minitest::ReturnInTestMethod
end
assert_equal(42, something)
skip if condition?
def test_something
# good
end
assert_equal(42, something)
return if condition?
def test_something
# bad
@example
Enforces the use of ‘skip` instead of `return` in test methods.
def inside_block?(node)
def inside_block?(node) node.ancestors.any?(&:block_type?) || node.ancestors.any?(&:numblock_type?) end
def on_return(node)
def on_return(node) return unless node.ancestors.any? { |parent| test_case?(parent) } return if inside_block?(node) add_offense(node) do |corrector| corrector.replace(node, 'skip') end end