Stop disabling sessions in test environement
Manually `disable :sessions` if you want to manually pass in the `rack.session` env key in your tests.
This commit is contained in:
parent
c6ea22bb8f
commit
341e3369d1
|
@ -916,7 +916,7 @@ module Sinatra
|
|||
# an instance of the class new was called on.
|
||||
def new(*args, &bk)
|
||||
builder = Rack::Builder.new
|
||||
builder.use Rack::Session::Cookie if sessions? && !test?
|
||||
builder.use Rack::Session::Cookie if sessions?
|
||||
builder.use Rack::CommonLogger if logging?
|
||||
builder.use Rack::MethodOverride if methodoverride?
|
||||
builder.use ShowExceptions if show_exceptions?
|
||||
|
|
|
@ -188,15 +188,22 @@ class HelpersTest < Test::Unit::TestCase
|
|||
|
||||
it 'creates a new session when none provided' do
|
||||
mock_app {
|
||||
enable :sessions
|
||||
|
||||
get '/' do
|
||||
assert session.empty?
|
||||
session[:foo] = 'bar'
|
||||
'Hi'
|
||||
redirect '/hi'
|
||||
end
|
||||
|
||||
get '/hi' do
|
||||
"hi #{session[:foo]}"
|
||||
end
|
||||
}
|
||||
|
||||
get '/'
|
||||
assert_equal 'Hi', body
|
||||
follow_redirect!
|
||||
assert_equal 'hi bar', body
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue