test/sessions_test.rb in sinatra-0.2.2 vs test/sessions_test.rb in sinatra-0.3.0

- old
+ new

@@ -1,29 +1,28 @@ require File.dirname(__FILE__) + '/helper' context "Sessions" do - - specify "should be off by default" do - Sinatra.application = nil + setup { Sinatra.application = nil } + + specify "should be off by default" do get '/asdf' do session[:test] = true "asdf" end get '/test' do session[:test] == true ? "true" : "false" end - + get_it '/asdf', {}, 'HTTP_HOST' => 'foo.sinatrarb.com' assert ok? assert !include?('Set-Cookie') end - + specify "should be able to store data accross requests" do - set_options(:sessions => true) - Sinatra.application = nil + set_option :sessions, true get '/foo' do session[:test] = true "asdf" end @@ -32,9 +31,9 @@ session[:test] == true ? "true" : "false" end get_it '/foo', :env => { :host => 'foo.sinatrarb.com' } assert ok? - assert include?('Set-Cookie') + assert include?('Set-Cookie') end - + end