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.5.27 test/lib/workarea/validators/parameter_validator_test.rb
workarea-core-3.5.26 test/lib/workarea/validators/parameter_validator_test.rb
workarea-core-3.4.45 test/lib/workarea/validators/parameter_validator_test.rb
workarea-core-3.5.25 test/lib/workarea/validators/parameter_validator_test.rb
workarea-core-3.5.23 test/lib/workarea/validators/parameter_validator_test.rb
workarea-core-3.4.44 test/lib/workarea/validators/parameter_validator_test.rb
workarea-core-3.5.22 test/lib/workarea/validators/parameter_validator_test.rb
workarea-core-3.4.43 test/lib/workarea/validators/parameter_validator_test.rb
workarea-core-3.5.21 test/lib/workarea/validators/parameter_validator_test.rb
workarea-core-3.4.42 test/lib/workarea/validators/parameter_validator_test.rb
workarea-core-3.5.20 test/lib/workarea/validators/parameter_validator_test.rb
workarea-core-3.4.41 test/lib/workarea/validators/parameter_validator_test.rb
workarea-core-3.5.19 test/lib/workarea/validators/parameter_validator_test.rb
workarea-core-3.4.40 test/lib/workarea/validators/parameter_validator_test.rb
workarea-core-3.5.18 test/lib/workarea/validators/parameter_validator_test.rb
workarea-core-3.4.39 test/lib/workarea/validators/parameter_validator_test.rb
workarea-core-3.5.17 test/lib/workarea/validators/parameter_validator_test.rb
workarea-core-3.4.38 test/lib/workarea/validators/parameter_validator_test.rb
workarea-core-3.5.16 test/lib/workarea/validators/parameter_validator_test.rb
workarea-core-3.4.37 test/lib/workarea/validators/parameter_validator_test.rb