class RuboCop::Cop::RSpec::NotToNot

Checks for consistent method usage for negating expectations.

@example

# bad
it '...' do
  expect(false).to_not be_true
end

# good
it '...' do
  expect(false).not_to be_true
end

Constants

MSG

Public Instance Methods

autocorrect(node) click to toggle source
# File lib/rubocop/cop/rspec/not_to_not.rb, line 29
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/not_to_not.rb, line 23
def on_send(node)
  not_to_not_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/not_to_not.rb, line 35
def message(_node)
  format(MSG, style, alternative_style)
end