test/support/validation_assertions.rb
# assert that the given klass validates the inclusion of the given attributes
assert that the given klass validates the inclusion of the given attributes
assert that the given klass validates the inclusion of the given attributes
def assert_validates_inclusion_of(klass, *attributes, value, message: I18n.t('errors.messages.inclusion'))
    attributes.each do |attribute|
      instance = klass.new(attribute => value)
      assert_not instance.save
      assert_includes instance.errors[attribute], message
      assert_has_validator klass, attribute,
                           ActiveModel::Validations::InclusionValidator
    end
  end
def assert_validates_inclusion_of ( klass , * attributes , value , message : I18n . t ( 'errors.messages.inclusion' ) ) attributes . each do | attribute | instance = klass . new ( attribute => value ) assert_not instance . save assert_includes instance . errors [ attribute ] , message assert_has_validator klass , attribute , ActiveModel :: Validations :: InclusionValidator end end
assert that the given klass validates the inclusion of the given attributes
assert that the given klass validates the inclusion of the given attributes
klass
attributes
value
message
t