Permalink
Browse files

Merge pull request #26 from cramerdev/use-registry-parser-before-regi…

…strar

don't raise PropertyNotAvailable.
  • Loading branch information...
2 parents cc7de27 + fabfcee commit 414328b5c0f944b969fdba528113051be9512573 Gabe Weaver committed Sep 6, 2012
Showing with 6 additions and 8 deletions.
  1. +1 −1 lib/whois/record/parser.rb
  2. +3 −5 spec/whois/record/parser_spec.rb
  3. +2 −2 spec/whois/record_spec.rb
@@ -303,7 +303,7 @@ def delegate_to_parsers(method, *args, &block)
# The property is not supported nor defined.
else
- raise PropertyNotAvailable, "Unable to find a parser for `#{method}'"
+ nil
end
end
@@ -109,11 +109,9 @@ class Whois::Record::Parser::ParserUnsupportedTest < Whois::Record::Parser::Base
end.should raise_error(Whois::PropertyNotSupported)
end
- it "raises when parsers are undefined" do
- lambda do
- r = Whois::Record.new(nil, [Whois::Record::Part.new(:body => "", :host => "parser.undefined.test"), Whois::Record::Part.new(:body => "", :host => "parser.undefined.test")])
- klass.new(r).created_on
- end.should raise_error(Whois::PropertyNotAvailable)
+ it "false when parsers are undefined" do
+ r = Whois::Record.new(nil, [Whois::Record::Part.new(:body => "", :host => "parser.undefined.test"), Whois::Record::Part.new(:body => "", :host => "parser.undefined.test")])
+ klass.new(r).created_on.should be_false
end
it "raises when zero parts" do
@@ -237,9 +237,9 @@ class Whois::Record::Parser::WhoisPropertiesTest < Whois::Record::Parser::Base
end
describe "property?" do
- it "raises a PropertyNotAvailable when the property is supported and has no value" do
+ it "returns false when the property is supported and has no value" do
r = klass.new(nil, [Whois::Record::Part.new(:body => "", :host => "whois.properties.test")])
- expect { r.status? }.to raise_error(Whois::PropertyNotAvailable)
+ r.status?.should be_false
end
it "returns true when the property is supported and has a value" do

0 comments on commit 414328b

Please sign in to comment.