Permalink
Browse files

Remove warnings [#372 state:resolved].

  • Loading branch information...
1 parent fd944cc commit 19fc2ccb89f6a13259658b14bb48eb83d106c4c1 @djanowski djanowski committed Apr 13, 2010
View
@@ -8,8 +8,8 @@ module MIME #: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
View
@@ -28,6 +28,7 @@ def self.from_scope(session, scope, selector) #:nodoc:
attr_reader :session
def initialize(session, &block) #:nodoc:
+ @selector, @dom = nil
@session = session
instance_eval(&block) if block_given?
@@ -75,6 +75,7 @@ def initialize(adapter = nil)
@data = {}
@default_headers = {}
@custom_headers = {}
+ @current_url = nil
reset
end
@@ -155,7 +156,7 @@ def success_code? #:nodoc:
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 @@ def response
end
def response_code
- @response_code || 200
+ @response_code ||= 200
end
def get(url, data, headers = nil)
@@ -106,24 +106,6 @@ def session.response_body
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

0 comments on commit 19fc2cc

Please sign in to comment.