Sha256: bec7a940c113651dc9dec507adf759da3d2ca0dff434948b4f77645d861f4db7

Contents?: true

Size: 552 Bytes

Versions: 5

Compression:

Stored size: 552 Bytes

Contents

require "test_helper"

class WithTldValidationTest < Minitest::Test
  test "rejects invalid TLD" do
    server = ServerWithTLD.new("example.xy")
    refute server.valid?
  end

  test "rejects only host label" do
    server = ServerWithTLD.new("com")
    refute server.valid?
  end

  TLDs.each do |tld|
    test "accepts #{tld} as TLD" do
      server = ServerWithTLD.new("example.#{tld}")
      assert server.valid?
    end
  end

  test "accepts example.com.br" do
    server = ServerWithTLD.new("example.com.br")
    assert server.valid?
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
validators-2.8.1 test/validators/validates_hostname_format_of/with_tld_validation_test.rb
validators-2.8.0 test/validators/validates_hostname_format_of/with_tld_validation_test.rb
validators-2.7.0 test/validators/validates_hostname_format_of/with_tld_validation_test.rb
validators-2.6.0 test/validators/validates_hostname_format_of/with_tld_validation_test.rb
validators-2.5.4 test/validators/validates_hostname_format_of/with_tld_validation_test.rb