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 35 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 29 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 41 def message(_node) format(MSG, replacement: style, original: alternative_style) end