Sha256: 745f92c03353abbb61cc79e50acd39f1d788b56939b47cece67394e5c1d21c62

Contents?: true

Size: 1.17 KB

Versions: 5

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::RSpec::Base; end
        NegationBeValid = ::RuboCop::Cop::RSpecRails::NegationBeValid
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rubocop-rspec-2.31.0 lib/rubocop/cop/rspec/rails/negation_be_valid.rb
rubocop-rspec-2.30.0 lib/rubocop/cop/rspec/rails/negation_be_valid.rb
rubocop-rspec-2.29.2 lib/rubocop/cop/rspec/rails/negation_be_valid.rb
rubocop-rspec-2.29.1 lib/rubocop/cop/rspec/rails/negation_be_valid.rb
rubocop-rspec-2.29.0 lib/rubocop/cop/rspec/rails/negation_be_valid.rb