#363 new
Kouhei Sutou

suppress uninitialized warning

Reported by Kouhei Sutou | March 4th, 2010 @ 03:15 AM

Webrat causes some uninitialized warning messages in $VERBOSE = true environment. e.g.:

lib/webrat/core/session.rb:151: warning: instance variable @_identical_redirect_count not initialized

The following test case reproduce the case:

$VERBOSE = true

require 'test/unit'
require 'rack/test'
require 'webrat'

Webrat.configure do |config|
  config.mode = :rack
end

class WarningTest < Test::Unit::TestCase
  include Rack::Test::Methods
  include Webrat::Methods

  def app
    Proc.new do |env|
      if env["PATH_INFO"] == "/"
        [303, {"Location" => "/redirect"}, []]
      else
        [200, {}, ["No content"]]
      end
    end
  end

  def test_redirect
    visit("/")
  end
end

The attached patch suppress the warnings.

No comments found

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Ruby Acceptance Testing for Web applications.

Shared Ticket Bins

People watching this ticket

Attachments

Pages