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
#example?, #example_group?, #example_group_with_body?, #explicit_rspec?, #hook?, #include?, #let?, #rspec?, #shared_group?, #spec_group?, #subject?
Instance Method Details
#not_to_not_offense(node) ⇒ Object
38 |
# File 'lib/rubocop/cop/rspec/not_to_not.rb', line 38 def_node_matcher :not_to_not_offense, '(send _ % ...)' |
#on_send(node) ⇒ Object
40 41 42 43 44 45 46 |
# File 'lib/rubocop/cop/rspec/not_to_not.rb', line 40 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 |