Sha256: 5129ed77e3201d130d423b6e0c9b3cdb119ebfe6a597d60b2a25b68b6c946ea7

Contents?: true

Size: 509 Bytes

Versions: 62

Compression:

Stored size: 509 Bytes

Contents

require 'test_helper'

class ParameterValidatorTest < Workarea::TestCase
  class FooModel
    include ActiveModel::Validations
  end

  def test_validate_each
    validator = ParameterValidator.new(attributes: { foo: 'bar' })
    model = FooModel.new

    string = (('a'..'z').to_a + ('A'..'Z').to_a + (0..9).to_a).join + '-_'
    validator.validate_each(model, :string, string)
    assert(model.errors.empty?)

    validator.validate_each(model, :string, ' &#.?')
    assert(model.errors.present?)
  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
workarea-core-3.4.13 test/lib/workarea/validators/parameter_validator_test.rb
workarea-core-3.4.12 test/lib/workarea/validators/parameter_validator_test.rb