Created
November 27, 2013 03:34
-
-
Save jasonngpt/7670304 to your computer and use it in GitHub Desktop.
Sinatra RSpec Session Variables
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
# my_test.rb (first line, or at least before you require your 'my_app.rb') | |
ENV['RACK_ENV'] = 'test' | |
# my_app.rb (your sinatra application) | |
enable :sessions unless test? | |
# my_test.rb (in your test block) | |
session = {} OR session = { "username" => "test" } | |
get '/', {}, 'rack.session' => session | |
assert_equal 'value', session[:key] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment