fixed Webrat::MechanizeSession - calling visit on a newly created session was failing. Default headers were not set and Webrat::Session#request_page would fail when Webrat::Session#headers was called - dup was being called on the nil headers

This commit is contained in:
Derek Kastner 2008-10-21 21:33:49 -04:00
parent 2fd734f9ff
commit 2d166ae2b8
2 changed files with 14 additions and 0 deletions

View File

@ -2,6 +2,7 @@ module Webrat
class MechanizeSession < Session class MechanizeSession < Session
def initialize(mechanize = WWW::Mechanize.new) def initialize(mechanize = WWW::Mechanize.new)
super()
@mechanize = mechanize @mechanize = mechanize
end end

View File

@ -0,0 +1,13 @@
require File.expand_path(File.dirname(__FILE__) + "/../../../lib/webrat/mechanize")
describe Webrat::MechanizeSession do
before(:each) do
@mech = Webrat::MechanizeSession.new
end
describe "headers method" do
it "should return empty headers for a newly initialized session" do
@mech.headers.should == {}
end
end
end