Sha256: 0bf5a73639cd53304ddeef4427cde3b497e8c48bef963c0ad8f9eace268e22b1

Contents?: true

Size: 689 Bytes

Versions: 62

Compression:

Stored size: 689 Bytes

Contents

require 'test_helper'

class EmailValidatorTest < Workarea::TestCase
  class FooModel
    include ActiveModel::Validations
    attr_accessor :email
  end

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

    validator.validate_each(model, :email, 'mdalton-test@workarea.com')
    assert(model.errors.empty?)

    validator.validate_each(model, :email, 'mdalton-test@foo.workarea.com')
    assert(model.errors.empty?)

    validator.validate_each(model, :email, 'mdalton-test')
    assert(model.errors.present?)

    validator.validate_each(model, :email, 'mdalton-test@workarea')
    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/email_validator_test.rb
workarea-core-3.5.26 test/lib/workarea/validators/email_validator_test.rb
workarea-core-3.4.45 test/lib/workarea/validators/email_validator_test.rb
workarea-core-3.5.25 test/lib/workarea/validators/email_validator_test.rb
workarea-core-3.5.23 test/lib/workarea/validators/email_validator_test.rb
workarea-core-3.4.44 test/lib/workarea/validators/email_validator_test.rb
workarea-core-3.5.22 test/lib/workarea/validators/email_validator_test.rb
workarea-core-3.4.43 test/lib/workarea/validators/email_validator_test.rb
workarea-core-3.5.21 test/lib/workarea/validators/email_validator_test.rb
workarea-core-3.4.42 test/lib/workarea/validators/email_validator_test.rb
workarea-core-3.5.20 test/lib/workarea/validators/email_validator_test.rb
workarea-core-3.4.41 test/lib/workarea/validators/email_validator_test.rb
workarea-core-3.5.19 test/lib/workarea/validators/email_validator_test.rb
workarea-core-3.4.40 test/lib/workarea/validators/email_validator_test.rb
workarea-core-3.5.18 test/lib/workarea/validators/email_validator_test.rb
workarea-core-3.4.39 test/lib/workarea/validators/email_validator_test.rb
workarea-core-3.5.17 test/lib/workarea/validators/email_validator_test.rb
workarea-core-3.4.38 test/lib/workarea/validators/email_validator_test.rb
workarea-core-3.5.16 test/lib/workarea/validators/email_validator_test.rb
workarea-core-3.4.37 test/lib/workarea/validators/email_validator_test.rb