class RuboCop::Cop::RSpec::IncludeExamples
Checks for usage of ‘include_examples`.
‘include_examples`, unlike `it_behaves_like`, does not create its own context. As such, using `subject`, `let`, `before`/`after`, etc. within shared examples included with `include_examples` can have unexpected behavior and side effects.
Prefer using ‘it_behaves_like` instead.
@example
# bad include_examples 'examples' # good it_behaves_like 'examples'
Constants
- MSG
- RESTRICT_ON_SEND
Public Instance Methods
Source
# File lib/rubocop/cop/rspec/include_examples.rb, line 29 def on_send(node) selector = node.loc.selector add_offense(selector) do |corrector| corrector.replace(selector, 'it_behaves_like') end end