Permalink
Browse files

Standard order for properties in parser and for specs

  • Loading branch information...
1 parent cab0948 commit 190570874a3f93b44af98e83779b2bd0cee1ab47 @kliuchnikau kliuchnikau committed Mar 20, 2012
@@ -22,22 +22,17 @@ class Parser
class WhoisCctldBy < Base
include Scanners::Ast
- # Initializes a new {Scanners::WhoisCctldBy} instance
- # passing the {#content_for_scanner}
- # and calls +parse+ on it.
- #
- # @return [Hash]
- def parse
- Scanners::WhoisCctldBy.new(content_for_scanner).parse
- end
+ property_not_supported :disclaimer
- property_supported :available? do
- !!node("status:available")
+ property_supported :domain do
+ node("Domain Name", &:downcase)
end
- property_supported :registered? do
- !available?
- end
+ property_not_supported :domain_id
+
+ property_not_supported :referral_whois
+
+ property_not_supported :referral_url
property_supported :status do
if available?
@@ -47,50 +42,55 @@ def parse
end
end
- property_supported :domain do
- node("Domain Name", &:downcase)
- end
-
- property_supported :registrar do
- node("Registrar") do |registrar|
- Record::Registrar.new(:id => registrar,
- :name => registrar,
- :organization => registrar
- )
- end
+ property_supported :available? do
+ !!node("status:available")
end
- property_supported :updated_on do
- node("Updated Date") { |value| Time.parse(value) }
+ property_supported :registered? do
+ !available?
end
property_supported :created_on do
node("Creation Date") { |value| Time.parse(value) }
end
+ property_supported :updated_on do
+ node("Updated Date") { |value| Time.parse(value) }
+ end
+
property_supported :expires_on do
node("Expiration Date") { |value| Time.parse(value) }
end
- property_supported :nameservers do
- Array.wrap(node("Name Server")).map do |name|
- Nameserver.new(name.downcase)
+ property_supported :registrar do
+ node("Registrar") do |registrar|
+ Record::Registrar.new(:id => registrar,
+ :name => registrar,
+ :organization => registrar
+ )
end
end
- property_not_supported :disclaimer
-
- property_not_supported :referral_whois
-
- property_not_supported :referral_url
-
- property_not_supported :domain_id
-
property_not_supported :registrant_contacts
property_not_supported :admin_contacts
property_not_supported :technical_contacts
+
+ property_supported :nameservers do
+ Array.wrap(node("Name Server")).map do |name|
+ Nameserver.new(name.downcase)
+ end
+ end
+
+ # Initializes a new {Scanners::WhoisCctldBy} instance
+ # passing the {#content_for_scanner}
+ # and calls +parse+ on it.
+ #
+ # @return [Hash]
+ def parse
+ Scanners::WhoisCctldBy.new(content_for_scanner).parse
+ end
end
end
end
@@ -1,50 +1,48 @@
-#status
- should: %s == :available
-
-#available?
- should: %s == true
-
-#registered?
- should: %s == false
-
+#disclaimer
+ should: %s raise_error(Whois::PropertyNotSupported)
#domain
should: %s == nil
#domain_id
should: %s raise_error(Whois::PropertyNotSupported)
-#registrant_contacts
+#referral_whois
should: %s raise_error(Whois::PropertyNotSupported)
-#admin_contacts
+#referral_url
should: %s raise_error(Whois::PropertyNotSupported)
-#technical_contacts
- should: %s raise_error(Whois::PropertyNotSupported)
+#status
+ should: %s == :available
-#registrar
- should: %s == nil
+#available?
+ should: %s == true
-#nameservers
- should: %s CLASS(array)
- should: %s == []
+#registered?
+ should: %s == false
-#updated_on
+#created_on
should: %s == nil
-#created_on
+#updated_on
should: %s == nil
#expires_on
should: %s == nil
+#registrar
+ should: %s == nil
-#disclaimer
+#registrant_contacts
should: %s raise_error(Whois::PropertyNotSupported)
-#referral_whois
+#admin_contacts
should: %s raise_error(Whois::PropertyNotSupported)
-#referral_url
- should: %s raise_error(Whois::PropertyNotSupported)
+#technical_contacts
+ should: %s raise_error(Whois::PropertyNotSupported)
+
+#nameservers
+ should: %s CLASS(array)
+ should: %s == []
@@ -1,60 +1,58 @@
-#status
- should: %s == :registered
-
-#available?
- should: %s == false
-
-#registered?
- should: %s == true
-
+#disclaimer
+ should: %s raise_error(Whois::PropertyNotSupported)
#domain
should: %s == "active.by"
#domain_id
should: %s raise_error(Whois::PropertyNotSupported)
-#registrant_contacts
- should: %s raise_error(Whois::PropertyNotSupported)
-
-#admin_contacts
+#referral_whois
should: %s raise_error(Whois::PropertyNotSupported)
-#technical_contacts
+#referral_url
should: %s raise_error(Whois::PropertyNotSupported)
-#registrar
- should: %s CLASS(registrar)
- should: %s.id == "Active Technologies LLC"
- should: %s.name == "Active Technologies LLC"
- should: %s.organization == "Active Technologies LLC"
+#status
+ should: %s == :registered
-#nameservers
- should: %s CLASS(array)
- should: %s SIZE(2)
- should: %s[0] CLASS(nameserver)
- should: %s[0].name == "ns1.activeby.net"
- should: %s[1] CLASS(nameserver)
- should: %s[1].name == "ns2.activeby.net"
+#available?
+ should: %s == false
-#updated_on
- should: %s CLASS(time)
- should: %s == Time.parse("2010-12-20 08:36:13 UTC")
+#registered?
+ should: %s == true
#created_on
should: %s CLASS(time)
should: %s == Time.parse("2003-02-02 15:50:44 UTC")
+#updated_on
+ should: %s CLASS(time)
+ should: %s == Time.parse("2010-12-20 08:36:13 UTC")
+
#expires_on
should: %s CLASS(time)
should: %s == Time.parse("2013-12-21 10:07:40 UTC")
+#registrar
+ should: %s CLASS(registrar)
+ should: %s.id == "Active Technologies LLC"
+ should: %s.name == "Active Technologies LLC"
+ should: %s.organization == "Active Technologies LLC"
+
+#registrant_contacts
+ should: %s raise_error(Whois::PropertyNotSupported)
-#disclaimer
+#admin_contacts
should: %s raise_error(Whois::PropertyNotSupported)
-#referral_whois
+#technical_contacts
should: %s raise_error(Whois::PropertyNotSupported)
-#referral_url
- should: %s raise_error(Whois::PropertyNotSupported)
+#nameservers
+ should: %s CLASS(array)
+ should: %s SIZE(2)
+ should: %s[0] CLASS(nameserver)
+ should: %s[0].name == "ns1.activeby.net"
+ should: %s[1] CLASS(nameserver)
+ should: %s[1].name == "ns2.activeby.net"
@@ -21,19 +21,9 @@
@parser = klass.new(part)
end
- describe "#status" do
- it do
- @parser.status.should == :available
- end
- end
- describe "#available?" do
- it do
- @parser.available?.should == true
- end
- end
- describe "#registered?" do
+ describe "#disclaimer" do
it do
- @parser.registered?.should == false
+ lambda { @parser.disclaimer }.should raise_error(Whois::PropertyNotSupported)
end
end
describe "#domain" do
@@ -46,60 +36,70 @@
lambda { @parser.domain_id }.should raise_error(Whois::PropertyNotSupported)
end
end
- describe "#registrant_contacts" do
+ describe "#referral_whois" do
it do
- lambda { @parser.registrant_contacts }.should raise_error(Whois::PropertyNotSupported)
+ lambda { @parser.referral_whois }.should raise_error(Whois::PropertyNotSupported)
end
end
- describe "#admin_contacts" do
+ describe "#referral_url" do
it do
- lambda { @parser.admin_contacts }.should raise_error(Whois::PropertyNotSupported)
+ lambda { @parser.referral_url }.should raise_error(Whois::PropertyNotSupported)
end
end
- describe "#technical_contacts" do
+ describe "#status" do
it do
- lambda { @parser.technical_contacts }.should raise_error(Whois::PropertyNotSupported)
+ @parser.status.should == :available
end
end
- describe "#registrar" do
+ describe "#available?" do
it do
- @parser.registrar.should == nil
+ @parser.available?.should == true
end
end
- describe "#nameservers" do
+ describe "#registered?" do
it do
- @parser.nameservers.should be_a(Array)
- @parser.nameservers.should == []
+ @parser.registered?.should == false
end
end
- describe "#updated_on" do
+ describe "#created_on" do
it do
- @parser.updated_on.should == nil
+ @parser.created_on.should == nil
end
end
- describe "#created_on" do
+ describe "#updated_on" do
it do
- @parser.created_on.should == nil
+ @parser.updated_on.should == nil
end
end
describe "#expires_on" do
it do
@parser.expires_on.should == nil
end
end
- describe "#disclaimer" do
+ describe "#registrar" do
it do
- lambda { @parser.disclaimer }.should raise_error(Whois::PropertyNotSupported)
+ @parser.registrar.should == nil
end
end
- describe "#referral_whois" do
+ describe "#registrant_contacts" do
it do
- lambda { @parser.referral_whois }.should raise_error(Whois::PropertyNotSupported)
+ lambda { @parser.registrant_contacts }.should raise_error(Whois::PropertyNotSupported)
end
end
- describe "#referral_url" do
+ describe "#admin_contacts" do
it do
- lambda { @parser.referral_url }.should raise_error(Whois::PropertyNotSupported)
+ lambda { @parser.admin_contacts }.should raise_error(Whois::PropertyNotSupported)
+ end
+ end
+ describe "#technical_contacts" do
+ it do
+ lambda { @parser.technical_contacts }.should raise_error(Whois::PropertyNotSupported)
+ end
+ end
+ describe "#nameservers" do
+ it do
+ @parser.nameservers.should be_a(Array)
+ @parser.nameservers.should == []
end
end
end
Oops, something went wrong.

0 comments on commit 1905708

Please sign in to comment.