Class: RuboCop::Cop::RSpec::ItBehavesLike
- Includes:
- ConfigurableEnforcedStyle
- Defined in:
- lib/rubocop/cop/rspec/it_behaves_like.rb
Overview
Checks that only one ‘it_behaves_like` style is used.
Constant Summary collapse
- MSG =
'Prefer `%<replacement>s` over `%<original>s` when including '\ 'examples in a nested context.'
Constants inherited from Cop
Cop::DEFAULT_CONFIGURATION, Cop::DEFAULT_PATTERN_RE
Constants included from RSpec::Language
RSpec::Language::ALL, RSpec::Language::RSPEC
Instance Method Summary collapse
Methods inherited from Cop
Instance Method Details
#autocorrect(node) ⇒ Object
35 36 37 |
# 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) ⇒ Object
29 30 31 32 33 |
# 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 |