How to test Sinatra app using session
问题 How to test Sinatra application wich is using session? get "/", {}, {'rack.session' => { 'foo' => 'blah' } } This code doesn't work for me, I have 'enable :sessions' in my app. 回答1: It looks like the problem is actually to have enable :sessions activated. You have to deactivate this setting in order to be available to overwrite the session . The solution could be: # my_test.rb (first line, or at least before you require your 'my_app.rb') ENV['RACK_ENV'] = 'test' # my_app.rb (your sinatra