Remove warnings [#372 state:resolved].
On why this is important: http://eigenclass.org/hiki/ruby-warnings-SEX-and-stds
This commit is contained in:
parent
fd944cccb5
commit
19fc2ccb89
|
@ -8,8 +8,8 @@ module Webrat #:nodoc:
|
|||
def mime_type(type)
|
||||
return type if type.nil? || type.to_s.include?("/")
|
||||
type = ".#{type}" unless type.to_s[0] == ?.
|
||||
MIME_TYPES.fetch(type) { |type|
|
||||
raise ArgumentError.new("Invalid Mime type: #{type}")
|
||||
MIME_TYPES.fetch(type) { |invalid_type|
|
||||
raise ArgumentError.new("Invalid Mime type: #{invalid_type}")
|
||||
}
|
||||
end
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@ module Webrat
|
|||
attr_reader :session
|
||||
|
||||
def initialize(session, &block) #:nodoc:
|
||||
@selector, @dom = nil
|
||||
@session = session
|
||||
instance_eval(&block) if block_given?
|
||||
|
||||
|
|
|
@ -75,6 +75,7 @@ For example:
|
|||
@data = {}
|
||||
@default_headers = {}
|
||||
@custom_headers = {}
|
||||
@current_url = nil
|
||||
reset
|
||||
end
|
||||
|
||||
|
@ -155,7 +156,7 @@ For example:
|
|||
end
|
||||
|
||||
def redirect? #:nodoc:
|
||||
response_code != 304 && (response_code / 100).to_i == 3
|
||||
[301, 302, 303, 307].include?(response_code)
|
||||
end
|
||||
|
||||
def internal_redirect?
|
||||
|
|
|
@ -15,7 +15,7 @@ module Webrat #:nodoc:
|
|||
end
|
||||
|
||||
def response_code
|
||||
@response_code || 200
|
||||
@response_code ||= 200
|
||||
end
|
||||
|
||||
def get(url, data, headers = nil)
|
||||
|
|
|
@ -106,24 +106,6 @@ describe Webrat::Session do
|
|||
webrat_session = Webrat::Session.new
|
||||
end
|
||||
|
||||
it "should return true if the last response was a redirect and Fixnum#/ returns a Rational" do
|
||||
# This happens if the ruby-units gem has been required
|
||||
Fixnum.class_eval do
|
||||
alias_method :original_divide, "/".to_sym
|
||||
|
||||
def /(other)
|
||||
Rational(self, other)
|
||||
end
|
||||
end
|
||||
|
||||
webrat_session.stub!(:response_code => 301)
|
||||
webrat_session.redirect?.should be_true
|
||||
|
||||
Fixnum.class_eval do
|
||||
alias_method "/".to_sym, :original_divide
|
||||
end
|
||||
end
|
||||
|
||||
it "should return true if the last response was a redirect" do
|
||||
webrat_session.stub!(:response_code => 301)
|
||||
webrat_session.redirect?.should be_true
|
||||
|
|
Loading…
Reference in New Issue