如何在RSpec测试中使会话正常工作?
我尝试过这样的事情:
describe "createnewlist_route_spec" do
include Rack::Test::Methods
use Rack::Session::Pool
def app
@app ||= Sinatra::Application
end
it "should save listitem to database" do
post '/addnewlistitem', {:item => 'testitem'}, :sessions => {:userid => '123'}
end
end
我是sinatra的菜鸟,所以我可能会走错路......