Class: RuboCop::Cop::RSpec::NotToNot
- Extended by:
- AutoCorrector
- Includes:
- ConfigurableEnforcedStyle
- Defined in:
- lib/rubocop/cop/rspec/not_to_not.rb
Overview
Checks for consistent method usage for negating expectations.
Constant Summary collapse
- MSG =
'Prefer `%<replacement>s` over `%<original>s`.'
- RESTRICT_ON_SEND =
%i[not_to to_not].freeze
Instance Method Summary collapse
Methods inherited from Base
inherited, #on_new_investigation
Methods included from RSpec::Language::NodePattern
Methods included from RSpec::Language
#example?, #example_group?, #example_group_with_body?, #hook?, #include?, #let?, #rspec?, #shared_group?, #spec_group?, #subject?
Instance Method Details
#not_to_not_offense(node) ⇒ Object
26 |
# File 'lib/rubocop/cop/rspec/not_to_not.rb', line 26 def_node_matcher :not_to_not_offense, '(send _ % ...)' |
#on_send(node) ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/rubocop/cop/rspec/not_to_not.rb', line 28 def on_send(node) not_to_not_offense(node, alternative_style) do add_offense(node.loc.selector) do |corrector| corrector.replace(node.loc.selector, style.to_s) end end end |