test/answer/parser/whois.nic.tl_test.rb in whois-1.1.2 vs test/answer/parser/whois.nic.tl_test.rb in whois-1.1.3

- old
+ new

@@ -8,14 +8,19 @@ @host = "whois.nic.tl" end def test_status - assert_equal :registered, - @klass.new(load_part('/registered.txt')).status - assert_equal :available, - @klass.new(load_part('/available.txt')).status + parser = @klass.new(load_part('/registered.txt')) + expected = :registered + assert_equal expected, parser.status + assert_equal expected, parser.instance_eval { @status } + + parser = @klass.new(load_part('/available.txt')) + expected = :available + assert_equal expected, parser.status + assert_equal expected, parser.instance_eval { @status } end def test_available? assert !@klass.new(load_part('/registered.txt')).available? assert @klass.new(load_part('/available.txt')).available? @@ -26,27 +31,42 @@ assert !@klass.new(load_part('/available.txt')).registered? end def test_created_on - assert_equal Time.parse("2003-05-23"), - @klass.new(load_part('/registered.txt')).created_on - assert_equal nil, - @klass.new(load_part('/available.txt')).created_on + parser = @klass.new(load_part('/registered.txt')) + expected = Time.parse("2003-05-23") + assert_equal expected, parser.created_on + assert_equal expected, parser.instance_eval { @created_on } + + parser = @klass.new(load_part('/available.txt')) + expected = nil + assert_equal expected, parser.created_on + assert_equal expected, parser.instance_eval { @created_on } end def test_updated_on - assert_equal Time.parse("2009-08-05"), - @klass.new(load_part('/registered.txt')).updated_on - assert_equal nil, - @klass.new(load_part('/available.txt')).updated_on + parser = @klass.new(load_part('/registered.txt')) + expected = Time.parse("2009-08-05") + assert_equal expected, parser.updated_on + assert_equal expected, parser.instance_eval { @updated_on } + + parser = @klass.new(load_part('/available.txt')) + expected = nil + assert_equal expected, parser.updated_on + assert_equal expected, parser.instance_eval { @updated_on } end def test_expires_on - assert_equal Time.parse("2010-05-23"), - @klass.new(load_part('/registered.txt')).expires_on - assert_equal nil, - @klass.new(load_part('/available.txt')).expires_on + parser = @klass.new(load_part('/registered.txt')) + expected = Time.parse("2010-05-23") + assert_equal expected, parser.expires_on + assert_equal expected, parser.instance_eval { @expires_on } + + parser = @klass.new(load_part('/available.txt')) + expected = nil + assert_equal expected, parser.expires_on + assert_equal expected, parser.instance_eval { @expires_on } end def test_nameservers parser = @klass.new(load_part('/registered.txt'))