test/answer/parser/base_test.rb in whois-0.9.0 vs test/answer/parser/base_test.rb in whois-1.0.0
- old
+ new
@@ -17,52 +17,39 @@
def test_initialize_should_require_part
assert_raise(ArgumentError) { @klass.new }
end
- # DEPRECATED
- def test_supported?
- klass = Class.new(@klass) do
- register_method(:disclaimer) {}
- end
- assert klass.new(@part).supported?(:disclaimer)
- assert klass.new(@part).respond_to?(:disclaimer)
-
- klass = Class.new(@klass) do
- end
- assert !klass.new(@part).supported?(:disclaimer)
- assert klass.new(@part).respond_to?(:disclaimer)
- end
-
- # DEPRECATED
- def test_supported_should_return_false_unless_registrable_method
+ def test_content
parser = @klass.new(@part)
- assert !parser.supported?(:content)
- assert parser.respond_to?(:content)
+ assert_equal @part.response, parser.content
end
+
def test_property_supported?
klass = Class.new(@klass) do
- register_method(:disclaimer) {}
end
- assert klass.new(@part).property_supported?(:disclaimer)
+ assert !klass.new(@part).property_supported?(:disclaimer)
assert klass.new(@part).respond_to?(:disclaimer)
klass = Class.new(@klass) do
+ register_property(:disclaimer, :supported) {}
end
- assert !klass.new(@part).property_supported?(:disclaimer)
+ assert klass.new(@part).property_supported?(:disclaimer)
assert klass.new(@part).respond_to?(:disclaimer)
end
- def test_property_supported_should_return_false_unless_registrable_method
- parser = @klass.new(@part)
- assert !parser.property_supported?(:content)
- assert parser.respond_to?(:content)
+
+ def test_self_property_registry
+ assert_instance_of Hash, @klass.property_registry
end
+ def test_self_property_registry_with_klass
+ assert_instance_of Hash, @klass.property_registry(Whois::Answer::Parser::WhoisNicIt)
+ end
- def test_content
- parser = @klass.new(@part)
- assert_equal @part.response, parser.content
+ def test_self_property_registry_with_klass_should_initialize_to_empty_hash
+ parser = Class.new
+ assert_equal Hash.new, @klass.property_registry(parser)
end
-
+
end
\ No newline at end of file