Permalink
Browse files

Rename #throttled? to #response_throttled? to uniform the name with o…

…ther response_? methods.
  • Loading branch information...
1 parent 1ea2c38 commit e8368f5f24d659f530f5de230309c0bd5e883595 @weppos committed Mar 1, 2011
Showing with 58 additions and 58 deletions.
  1. +1 −1 CHANGELOG.rdoc
  2. +3 −3 lib/whois/answer.rb
  3. +5 −5 lib/whois/answer/parser.rb
  4. +5 −5 lib/whois/answer/parser/base.rb
  5. +1 −1 lib/whois/answer/parser/whois.denic.de.rb
  6. +1 −1 lib/whois/answer/parser/whois.domain-registry.nl.rb
  7. +1 −1 lib/whois/answer/parser/whois.publicinterestregistry.net.rb
  8. +1 −1 lib/whois/errors.rb
  9. +1 −1 spec/fixtures/responses/whois.denic.de/schema-2.0/response_throttled.expected
  10. +1 −1 spec/fixtures/responses/whois.denic.de/schema-2.0/status_registered.expected
  11. +1 −1 spec/fixtures/responses/whois.domain-registry.nl/response_throttled.expected
  12. +1 −1 spec/fixtures/responses/whois.domain-registry.nl/response_throttled_daily.expected
  13. +1 −1 spec/fixtures/responses/whois.domain-registry.nl/status_registered.expected
  14. +1 −1 spec/fixtures/responses/whois.publicinterestregistry.net/response_throttled.expected
  15. +1 −1 spec/fixtures/responses/whois.publicinterestregistry.net/status_registered.expected
  16. +10 −10 spec/whois/answer/parser/base_spec.rb
  17. +2 −2 spec/whois/answer/parser/responses/whois.denic.de/schema-2.0/response_throttled_spec.rb
  18. +2 −2 spec/whois/answer/parser/responses/whois.denic.de/schema-2.0/status_registered_spec.rb
  19. +2 −2 spec/whois/answer/parser/responses/whois.domain-registry.nl/response_throttled_daily_spec.rb
  20. +2 −2 spec/whois/answer/parser/responses/whois.domain-registry.nl/response_throttled_spec.rb
  21. +2 −2 spec/whois/answer/parser/responses/whois.domain-registry.nl/status_registered_spec.rb
  22. +2 −2 spec/whois/answer/parser/responses/whois.publicinterestregistry.net/response_throttled_spec.rb
  23. +2 −2 spec/whois/answer/parser/responses/whois.publicinterestregistry.net/status_registered_spec.rb
  24. +6 −6 spec/whois/answer/parser_spec.rb
  25. +3 −3 spec/whois/answer_spec.rb
View
@@ -69,7 +69,7 @@
* CHANGED: Renamed Whois::Server::Adapters::Base#append_to_buffer to buffer_append.
-* CHANGED: Whois::Answer::Parser::Base#throttled? and Whois::Answer::Parser::Base#invalid? are not defined by default.
+* CHANGED: Whois::Answer::Parser::Base#response_throttled? and Whois::Answer::Parser::Base#invalid? are not defined by default.
Define the method in the implementation, and Whois::Answer::Parser will automatically use it.
* CHANGED: Removed &block from method definition to avoid creating block objects when yield is used (#66)
View
@@ -224,10 +224,10 @@ def unchanged?(other)
#
# @return [Boolean]
#
- # @see Whois::Answer::Parser#throttled?
+ # @see Whois::Answer::Parser#response_throttled?
#
- def throttled?
- parser.throttled?
+ def response_throttled?
+ parser.response_throttled?
end
# Checks whether this is an incomplete response.
View
@@ -31,7 +31,7 @@ class Parser
METHODS = [
:changed?, :unchanged?,
:contacts,
- # :throttled?, :response_incomplete?,
+ # :response_throttled?, :response_incomplete?,
]
PROPERTIES = [
@@ -235,11 +235,11 @@ def unchanged?(other)
#
# @return [Boolean]
#
- # @see Whois::Answer#throttled?
- # @see Whois::Answer::Parser::Base#throttled?
+ # @see Whois::Answer#response_throttled?
+ # @see Whois::Answer::Parser::Base#response_throttled?
#
- def throttled?
- any_is?(parsers, :throttled?)
+ def response_throttled?
+ any_is?(parsers, :response_throttled?)
end
# Loop through all the parts to check if at least
@@ -259,7 +259,7 @@ def is(symbol)
# @api internal
def validate!
- raise ResponseIsThrottled if is(:throttled?)
+ raise ResponseIsThrottled if is(:response_throttled?)
end
@@ -341,10 +341,10 @@ def unchanged?(other)
# @abstract This method is just a stub.
# Define it in your parser class.
#
- # @see Whois::Answer#throttled?
- # @see Whois::Answer::Parser#throttled?
+ # @see Whois::Answer#response_throttled?
+ # @see Whois::Answer::Parser#response_throttled?
#
- def throttled?
+ def response_throttled?
end
# Checks whether this is an incomplete response.
@@ -376,7 +376,7 @@ def response_unavailable?
# Let them be documented
undef :response_incomplete?
- undef :throttled?
+ undef :response_throttled?
undef :response_unavailable?
# @endgroup
@@ -127,7 +127,7 @@ class WhoisDenicDe < Base
# @example
# % Error: 55000000002 Connection refused; access control limit reached.
#
- def throttled?
+ def response_throttled?
!!node("response-throttled")
end
@@ -91,7 +91,7 @@ class WhoisDomainRegistryNl < Base
# @example
# whois.domain-registry.nl: daily whois-limit exceeded
#
- def throttled?
+ def response_throttled?
case content_for_scanner
when /^#{Regexp.escape("whois.domain-registry.nl: only 1 request per second allowed, try again later")}/
true
@@ -113,7 +113,7 @@ class WhoisPublicinterestregistryNet < Base
# @example
# WHOIS LIMIT EXCEEDED - SEE WWW.PIR.ORG/WHOIS FOR DETAILS
#
- def throttled?
+ def response_throttled?
!!node("response-throttled")
end
View
@@ -133,7 +133,7 @@ class ResponseError < Error
# Raised when attempting to access a property when the response is throttled.
#
- # @see Whois::Answer::Parser::Base#throttled?
+ # @see Whois::Answer::Parser::Base#response_throttled?
class ResponseIsThrottled < ResponseError
end
@@ -1,2 +1,2 @@
-#throttled?
+#response_throttled?
should: %s == true
@@ -1,2 +1,2 @@
-#throttled?
+#response_throttled?
should: %s == false
@@ -1,2 +1,2 @@
-#throttled?
+#response_throttled?
should: %s == true
@@ -1,2 +1,2 @@
-#throttled?
+#response_throttled?
should: %s == true
@@ -1,4 +1,4 @@
-#throttled?
+#response_throttled?
should: %s == false
#response_unavailable?
@@ -1,2 +1,2 @@
-#throttled?
+#response_throttled?
should: %s == true
@@ -1,2 +1,2 @@
-#throttled?
+#response_throttled?
should: %s == false
@@ -115,21 +115,21 @@
describe "#is" do
it "calls the method if the object respond to the method" do
- i = Class.new(klass) { def throttled?; true; end }.new(Whois::Answer::Part.new)
- i.is(:throttled?)
+ i = Class.new(klass) { def response_throttled?; true; end }.new(Whois::Answer::Part.new)
+ i.is(:response_throttled?)
end
it "does not call the method if the object does not respond to the method" do
i = Class.new(klass).new(Whois::Answer::Part.new)
- i.is(:throttled?).should be_false
+ i.is(:response_throttled?).should be_false
end
end
describe "#validate!" do
it "raises Whois::ResponseIsThrottled when the response is throttled" do
- i = Class.new(klass) { def throttled?; true; end }.new(Whois::Answer::Part.new)
+ i = Class.new(klass) { def response_throttled?; true; end }.new(Whois::Answer::Part.new)
lambda { i.validate! }.should raise_error(Whois::ResponseIsThrottled)
- i = Class.new(klass) { def throttled?; false; end }.new(Whois::Answer::Part.new)
+ i = Class.new(klass) { def response_throttled?; false; end }.new(Whois::Answer::Part.new)
lambda { i.validate! }.should_not raise_error
end
end
@@ -197,19 +197,19 @@
end
- describe "#throttled?" do
+ describe "#response_throttled?" do
it "is undefined" do
- klass.new(@part).respond_to?(:throttled?).should be_false
+ klass.new(@part).respond_to?(:response_throttled?).should be_false
end
# it "returns nil" do
# i = klass.new(@part)
- # i.throttled?.should be_nil
+ # i.response_throttled?.should be_nil
# end
#
# it "is false" do
# i = klass.new(@part)
- # i.throttled?.should be_false
+ # i.response_throttled?.should be_false
# end
end
@@ -253,7 +253,7 @@
property_supported(:domain) { "example.com" }
property_not_supported(:domain_id)
- def throttled?
+ def response_throttled?
part.host == "throttled.whois.test"
end
end
@@ -19,9 +19,9 @@
@parser = klass.new(part)
end
- context "#throttled?" do
+ context "#response_throttled?" do
it do
- @parser.throttled?.should == true
+ @parser.response_throttled?.should == true
end
end
end
@@ -19,9 +19,9 @@
@parser = klass.new(part)
end
- context "#throttled?" do
+ context "#response_throttled?" do
it do
- @parser.throttled?.should == false
+ @parser.response_throttled?.should == false
end
end
end
@@ -19,9 +19,9 @@
@parser = klass.new(part)
end
- context "#throttled?" do
+ context "#response_throttled?" do
it do
- @parser.throttled?.should == true
+ @parser.response_throttled?.should == true
end
end
end
@@ -19,9 +19,9 @@
@parser = klass.new(part)
end
- context "#throttled?" do
+ context "#response_throttled?" do
it do
- @parser.throttled?.should == true
+ @parser.response_throttled?.should == true
end
end
end
@@ -19,9 +19,9 @@
@parser = klass.new(part)
end
- context "#throttled?" do
+ context "#response_throttled?" do
it do
- @parser.throttled?.should == false
+ @parser.response_throttled?.should == false
end
end
context "#response_unavailable?" do
@@ -19,9 +19,9 @@
@parser = klass.new(part)
end
- context "#throttled?" do
+ context "#response_throttled?" do
it do
- @parser.throttled?.should == true
+ @parser.response_throttled?.should == true
end
end
end
@@ -19,9 +19,9 @@
@parser = klass.new(part)
end
- context "#throttled?" do
+ context "#response_throttled?" do
it do
- @parser.throttled?.should == false
+ @parser.response_throttled?.should == false
end
end
end
@@ -295,18 +295,18 @@ class Whois::Answer::Parser::Contacts3Test< Whois::Answer::Parser::Base
end
end
- describe "#throttled?" do
+ describe "#response_throttled?" do
it "returns false when all parts are not throttled" do
i = parsers("defined-false", "defined-false")
- i.throttled?.should == false
+ i.response_throttled?.should == false
end
it "returns true when at least one part is throttled" do
i = parsers("defined-false", "defined-true")
- i.throttled?.should == true
+ i.response_throttled?.should == true
i = parsers("defined-true", "defined-false")
- i.throttled?.should == true
+ i.response_throttled?.should == true
end
end
@@ -329,7 +329,7 @@ class Whois::Answer::Parser::Contacts3Test< Whois::Answer::Parser::Base
private
class Whois::Answer::Parser::ResponseDefinedTrueTest < Whois::Answer::Parser::Base
- def throttled?
+ def response_throttled?
true
end
def response_incomplete?
@@ -338,7 +338,7 @@ def response_incomplete?
end
class Whois::Answer::Parser::ResponseDefinedFalseTest < Whois::Answer::Parser::Base
- def throttled?
+ def response_throttled?
false
end
def response_incomplete?
@@ -305,11 +305,11 @@ class Whois::Answer::Parser::WhoisPropertiesTest < Whois::Answer::Parser::Base
end
- describe "#throttled?" do
+ describe "#response_throttled?" do
it "delegates to #parser" do
i = klass.new(nil, [])
- i.parser.expects(:throttled?)
- i.throttled?
+ i.parser.expects(:response_throttled?)
+ i.response_throttled?
end
end

0 comments on commit e8368f5

Please sign in to comment.