Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Standard order for properties in parser and for specs

  • Loading branch information...
commit 190570874a3f93b44af98e83779b2bd0cee1ab47 1 parent cab0948
@kliuchnikau kliuchnikau authored
View
74 lib/whois/record/parser/whois.cctld.by.rb
@@ -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
View
46 spec/fixtures/responses/whois.cctld.by/status_available.expected
@@ -1,12 +1,5 @@
-#status
- should: %s == :available
-
-#available?
- should: %s == true
-
-#registered?
- should: %s == false
-
+#disclaimer
+ should: %s raise_error(Whois::PropertyNotSupported)
#domain
should: %s == nil
@@ -14,37 +7,42 @@
#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 == []
View
64 spec/fixtures/responses/whois.cctld.by/status_registered.expected
@@ -1,12 +1,5 @@
-#status
- should: %s == :registered
-
-#available?
- should: %s == false
-
-#registered?
- should: %s == true
-
+#disclaimer
+ should: %s raise_error(Whois::PropertyNotSupported)
#domain
should: %s == "active.by"
@@ -14,47 +7,52 @@
#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"
View
66 spec/whois/record/parser/responses/whois.cctld.by/status_available_spec.rb
@@ -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,40 +36,39 @@
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
@@ -87,19 +76,30 @@
@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
View
84 spec/whois/record/parser/responses/whois.cctld.by/status_registered_spec.rb
@@ -21,19 +21,9 @@
@parser = klass.new(part)
end
- describe "#status" do
- it do
- @parser.status.should == :registered
- end
- end
- describe "#available?" do
- it do
- @parser.available?.should == false
- end
- end
- describe "#registered?" do
+ describe "#disclaimer" do
it do
- @parser.registered?.should == true
+ lambda { @parser.disclaimer }.should raise_error(Whois::PropertyNotSupported)
end
end
describe "#domain" do
@@ -46,43 +36,29 @@
lambda { @parser.domain_id }.should raise_error(Whois::PropertyNotSupported)
end
end
- describe "#registrant_contacts" do
- it do
- lambda { @parser.registrant_contacts }.should raise_error(Whois::PropertyNotSupported)
- end
- end
- describe "#admin_contacts" do
+ describe "#referral_whois" do
it do
- lambda { @parser.admin_contacts }.should raise_error(Whois::PropertyNotSupported)
+ lambda { @parser.referral_whois }.should raise_error(Whois::PropertyNotSupported)
end
end
- describe "#technical_contacts" do
+ describe "#referral_url" do
it do
- lambda { @parser.technical_contacts }.should raise_error(Whois::PropertyNotSupported)
+ lambda { @parser.referral_url }.should raise_error(Whois::PropertyNotSupported)
end
end
- describe "#registrar" do
+ describe "#status" do
it do
- @parser.registrar.should be_a(Whois::Record::Registrar)
- @parser.registrar.id.should == "Active Technologies LLC"
- @parser.registrar.name.should == "Active Technologies LLC"
- @parser.registrar.organization.should == "Active Technologies LLC"
+ @parser.status.should == :registered
end
end
- describe "#nameservers" do
+ describe "#available?" do
it do
- @parser.nameservers.should be_a(Array)
- @parser.nameservers.should have(2).items
- @parser.nameservers[0].should be_a(Whois::Record::Nameserver)
- @parser.nameservers[0].name.should == "ns1.activeby.net"
- @parser.nameservers[1].should be_a(Whois::Record::Nameserver)
- @parser.nameservers[1].name.should == "ns2.activeby.net"
+ @parser.available?.should == false
end
end
- describe "#updated_on" do
+ describe "#registered?" do
it do
- @parser.updated_on.should be_a(Time)
- @parser.updated_on.should == Time.parse("2010-12-20 08:36:13 UTC")
+ @parser.registered?.should == true
end
end
describe "#created_on" do
@@ -91,25 +67,49 @@
@parser.created_on.should == Time.parse("2003-02-02 15:50:44 UTC")
end
end
+ describe "#updated_on" do
+ it do
+ @parser.updated_on.should be_a(Time)
+ @parser.updated_on.should == Time.parse("2010-12-20 08:36:13 UTC")
+ end
+ end
describe "#expires_on" do
it do
@parser.expires_on.should be_a(Time)
@parser.expires_on.should == Time.parse("2013-12-21 10:07:40 UTC")
end
end
- describe "#disclaimer" do
+ describe "#registrar" do
it do
- lambda { @parser.disclaimer }.should raise_error(Whois::PropertyNotSupported)
+ @parser.registrar.should be_a(Whois::Record::Registrar)
+ @parser.registrar.id.should == "Active Technologies LLC"
+ @parser.registrar.name.should == "Active Technologies LLC"
+ @parser.registrar.organization.should == "Active Technologies LLC"
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 have(2).items
+ @parser.nameservers[0].should be_a(Whois::Record::Nameserver)
+ @parser.nameservers[0].name.should == "ns1.activeby.net"
+ @parser.nameservers[1].should be_a(Whois::Record::Nameserver)
+ @parser.nameservers[1].name.should == "ns2.activeby.net"
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.