Sha256: 0f719ca6794d046f9b2f9b0255eb39099c7fec76493d7fbbf05f785ef3bca4b1

Contents?: true

Size: 1.3 KB

Versions: 37

Compression:

Stored size: 1.3 KB

Contents

module Shoulda
  module Matchers
    module ActiveModel
      # @private
      class CouldNotDetermineValueOutsideOfArray < RuntimeError; end

      # @private
      class NonNullableBooleanError < Shoulda::Matchers::Error
        def self.create(attribute)
          super(attribute: attribute)
        end

        attr_accessor :attribute

        def message
          <<-EOT.strip
You have specified that your model's #{attribute} should ensure inclusion of nil.
However, #{attribute} is a boolean column which does not allow null values.
Hence, this test will fail and there is no way to make it pass.
          EOT
        end
      end

      # @private
      class CouldNotSetPasswordError < Shoulda::Matchers::Error
        def self.create(model)
          super(model: model)
        end

        attr_accessor :model

        def message
          <<-EOT.strip
The validation failed because your #{model_name} model declares `has_secure_password`, and
`validate_presence_of` was called on a #{record_name} which has `password` already set to a value.
Please use a #{record_name} with an empty `password` instead.
          EOT
        end

        private

        def model_name
          model.name
        end

        def record_name
          model_name.humanize.downcase
        end
      end
    end
  end
end

Version data entries

37 entries across 37 versions & 3 rubygems

Version Path
shoulda-matchers-4.0.1 lib/shoulda/matchers/active_model/errors.rb
shoulda-matchers-3.1.3 lib/shoulda/matchers/active_model/errors.rb
shoulda-matchers-4.0.0.rc1 lib/shoulda/matchers/active_model/errors.rb
shoulda-matchers-3.1.2 lib/shoulda/matchers/active_model/errors.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/shoulda-matchers-2.8.0/lib/shoulda/matchers/active_model/errors.rb
shoulda-matchers-3.1.1 lib/shoulda/matchers/active_model/errors.rb
shoulda-matchers-3.1.0 lib/shoulda/matchers/active_model/errors.rb
shoulda-matchers-3.0.1 lib/shoulda/matchers/active_model/errors.rb
shoulda-matchers-3.0.0 lib/shoulda/matchers/active_model/errors.rb
shoulda-matchers-3.0.0.rc1 lib/shoulda/matchers/active_model/errors.rb
shoulda-matchers-2.8.0 lib/shoulda/matchers/active_model/errors.rb
shoulda-matchers-2.8.0.rc2 lib/shoulda/matchers/active_model/errors.rb
shoulda-matchers-2.8.0.rc1 lib/shoulda/matchers/active_model/errors.rb
shoulda-matchers-2.7.0 lib/shoulda/matchers/active_model/errors.rb
shoulda-matchers-2.6.2 lib/shoulda/matchers/active_model/errors.rb
mcmire-shoulda-matchers-2.6.2.docs.1 lib/shoulda/matchers/active_model/errors.rb
mcmire-shoulda-matchers-2.6.1.docs.1 lib/shoulda/matchers/active_model/errors.rb