2018-05-30 12:04:07 +02:00
|
|
|
require "test_helper"
|
|
|
|
require "whois/parser"
|
|
|
|
require "whois/errors"
|
|
|
|
|
|
|
|
module Whois
|
|
|
|
class ParserTest < ActiveSupport::TestCase
|
2018-06-05 16:39:08 +02:00
|
|
|
test "should instanciate a parser class matching AFNIC tlds" do
|
2018-06-05 16:42:04 +02:00
|
|
|
assert_kind_of Parser::AFNIC, Parser.for("example.fr")
|
2018-06-05 16:39:08 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
test "should instanciate a parser class matching Verisign tlds" do
|
|
|
|
assert_kind_of Parser::Verisign, Parser.for("example.com")
|
|
|
|
assert_kind_of Parser::Verisign, Parser.for("example.net")
|
|
|
|
end
|
2018-05-30 12:04:07 +02:00
|
|
|
|
2018-06-05 16:39:08 +02:00
|
|
|
test "should raises an exception when a domain is not supported" do
|
2018-05-30 12:04:07 +02:00
|
|
|
assert_raises UnsupportedDomainError do
|
|
|
|
Parser.for("example.xyz")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|