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
RESTRICT_ON_SEND

Public Instance Methods

on_send(node) click to toggle source
# File lib/rubocop/cop/rspec/it_behaves_like.rb, line 32
def on_send(node)
  example_inclusion_offense(node, alternative_style) do
    add_offense(node) do |corrector|
      corrector.replace(node.loc.selector, style.to_s)
    end
  end
end

Private Instance Methods

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