1
我正在用sinatra在webrat中寫一些測試,並且作爲我需要會話的一部分。錯誤的參數類型類(預期的模塊)(TypeError)
webrat wiki提到我需要撥打use Rack::Session::Cookie
而不是enable :sessions
- 我已經這樣做了。
這個特殊的測試是這樣的:
class RegisterNewUserTest < Test::Unit::TestCase
include Webrat::Methods
include Webrat::Matchers
include Webrat::Session
def app
Rack::Builder.parse_file('config.ru').first
end
def register_new_user
visit '/signup'
fill_in "user[email]", :with => "[email protected]"
set_hidden_field "user[password]", :to => "password"
set_hidden_field "user[password_confirmation]", :to => "password"
click_button "Register"
end
end
當我運行它,我得到以下錯誤:
in `include': wrong argument type Class (expected Module) (TypeError)
from test.rb:77:in `<class:RegisterNewUserTest>'
from test.rb:74:in `<main>'
當我刪除Webrat::Session
它消失了,但後來我的測試是沒用的。
你需要提一個問題;) – BoltClock 2012-03-09 07:31:40