Sha256: 1b6409f221cafcb796fe75232ad6e0316189631ceaa19786e196ecb94a2d90e7
Contents?: true
Size: 954 Bytes
Versions: 11
Compression:
Stored size: 954 Bytes
Contents
module RuboCop module Cop module RSpec # Check for expectations where `be` is used without argument. # # The `be` matcher is too generic, as it pass on everything that is not # nil or false. If that is the exact intend, use `be_truthy`. In all other # cases it's better to specify what exactly is the expected value. # # @example # # # bad # expect(foo).to be # # # good # expect(foo).to be_truthy # expect(foo).to be 1.0 # expect(foo).to be(true) # class Be < Cop MSG = 'Don\'t use `be` without an argument.'.freeze def_node_matcher :be_without_args, <<-PATTERN (send _ {:to :not_to :to_not} $(send nil? :be)) PATTERN def on_send(node) be_without_args(node) do |matcher| add_offense(matcher, location: :selector) end end end end end end
Version data entries
11 entries across 11 versions & 1 rubygems