Sha256: 8b0e39b46aa16359a866e5c0a5961effe3bdbf92a1841ef863bf81551ea3325c
Contents?: true
Size: 921 Bytes
Versions: 8
Compression:
Stored size: 921 Bytes
Contents
module RuboCop module Cop module RSpec # 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 class NotToNot < Cop include ConfigurableEnforcedStyle MSG = 'Prefer `%s` over `%s`.'.freeze def_node_matcher :not_to_not_offense, '(send _ % ...)' def on_send(node) not_to_not_offense(node, alternative_style) do add_offense(node, :expression) end end def autocorrect(node) ->(corrector) { corrector.replace(node.loc.selector, style.to_s) } end private def message(_node) format(MSG, style, alternative_style) end end end end end
Version data entries
8 entries across 8 versions & 1 rubygems