Sha256: 6686af43cca663d203b5115914a48a9917dfa2a263c5f1871dc7265f33d2d161
Contents?: true
Size: 931 Bytes
Versions: 3
Compression:
Stored size: 931 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, location: :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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rubocop-rspec-1.20.1 | lib/rubocop/cop/rspec/not_to_not.rb |
rubocop-rspec-1.20.0 | lib/rubocop/cop/rspec/not_to_not.rb |
rubocop-rspec-1.19.0 | lib/rubocop/cop/rspec/not_to_not.rb |