class RuboCop::Cop::RSpec::ItBehavesLike

Checks that only one `it_behaves_like` style is used.

@example when configuration is `EnforcedStyle: it_behaves_like`

# bad
it_should_behave_like 'a foo'

# good
it_behaves_like 'a foo'

@example when configuration is `EnforcedStyle: it_should_behave_like`

# bad
it_behaves_like 'a foo'

# good
it_should_behave_like 'a foo'

Constants

MSG

Public Instance Methods

autocorrect(node) click to toggle source
# File lib/rubocop/cop/rspec/it_behaves_like.rb, line 34
def autocorrect(node)
  ->(corrector) { corrector.replace(node.loc.selector, style.to_s) }
end
on_send(node) click to toggle source
# File lib/rubocop/cop/rspec/it_behaves_like.rb, line 28
def on_send(node)
  example_inclusion_offense(node, alternative_style) do
    add_offense(node, location: :expression)
  end
end

Private Instance Methods

message(_node) click to toggle source
# File lib/rubocop/cop/rspec/it_behaves_like.rb, line 40
def message(_node)
  format(MSG, style, alternative_style)
end