class RuboCop::Cop::RSpec::NotToNot
end
expect(false).not_to be_true
it ‘…’ do
# good
end
expect(false).to_not be_true
it ‘…’ do
# bad
@example
expectations.
Enforces the usage of the same method on all negative message
def autocorrect(node)
def autocorrect(node) _receiver, method_name, *_args = *node lambda do |corrector| corrector.replace(node.loc.selector, method_name.equal?(:not_to) ? 'to_not' : 'not_to') end end
def message(node)
def message(node) _receiver, method_name, *_args = *node if method_name.equal?(:not_to) format(MSG, 'to_not', 'not_to') else format(MSG, 'not_to', 'to_not') end end
def on_send(node)
def on_send(node) _receiver, method_name, *_args = *node return unless METHOD_NAMES.include?(method_name) return if style.equal?(method_name) add_offense(node, :expression) end