Created
June 16, 2012 08:24
-
-
Save loz/2940508 to your computer and use it in GitHub Desktop.
Setting Session in Sinatra/Rspec
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Took me ages to work this out: | |
def setup_session(session = {}) | |
Rack::Session::Abstract::SessionHash.stub(:new).and_return(session) | |
end | |
#then in your tests | |
before :each do | |
setup_session :user_id => User.first.id | |
get '/user_required' | |
end | |
it "works!" do | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment