1

How can I make sessions work in my RSpec tests?

I have tried something like this:

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

I'm a noob to sinatra, so I might be on the wrong track here...

1 Answer 1

0

This solved my problem: http://gist.github.com/375973

Not quite what I wanted, but it works in my tests.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.