Sha256: b85f5791cec23635318b060e48552837299c348d1ab2c57fe3cfaea948cda66d

Contents?: true

Size: 1.17 KB

Versions: 1

Compression:

Stored size: 1.17 KB

Contents

# frozen_string_literal: true

module RuboCop
  module Cop
    module RSpec
      module Rails
        # @!parse
        #   # Enforces use of `be_invalid` or `not_to` for negated be_valid.
        #   #
        #   # @safety
        #   #   This cop is unsafe because it cannot guarantee that
        #   #   the test target is an instance of `ActiveModel::Validations``.
        #   #
        #   # @example EnforcedStyle: not_to (default)
        #   #   # bad
        #   #   expect(foo).to be_invalid
        #   #
        #   #   # good
        #   #   expect(foo).not_to be_valid
        #   #
        #   #   # good (with method chain)
        #   #   expect(foo).to be_invalid.and be_odd
        #   #
        #   # @example EnforcedStyle: be_invalid
        #   #   # bad
        #   #   expect(foo).not_to be_valid
        #   #
        #   #   # good
        #   #   expect(foo).to be_invalid
        #   #
        #   #   # good (with method chain)
        #   #   expect(foo).to be_invalid.or be_even
        #   #
        #   class NegationBeValid < RuboCop::Cop::RSpecRails::Base; end
        NegationBeValid = ::RuboCop::Cop::RSpecRails::NegationBeValid
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rubocop-rspec-2.28.0 lib/rubocop/cop/rspec/rails/negation_be_valid.rb