Sha256: abd7288aafe710769830ed61c56061900e17d85543693bd4af8e48c88e637491

Contents?: true

Size: 763 Bytes

Versions: 63

Compression:

Stored size: 763 Bytes

Contents

require File.dirname(__FILE__) + '/helper'

context "Sessions" do

  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_option :sessions, true

    get '/foo' do
      session[:test] = true
      "asdf"
    end

    get '/bar' do
      session[:test] == true ? "true" : "false"
    end

    get_it '/foo', :env => { :host => 'foo.sinatrarb.com' }
    assert ok?
    assert include?('Set-Cookie')
  end

end

Version data entries

63 entries across 63 versions & 12 rubygems

Version Path
relevance-castronaut-0.3.5 vendor/sinatra/test/sessions_test.rb
relevance-castronaut-0.3.6 vendor/sinatra/test/sessions_test.rb
relevance-castronaut-0.4.1 vendor/sinatra/test/sessions_test.rb
relevance-castronaut-0.4.2 vendor/sinatra/test/sessions_test.rb
relevance-castronaut-0.4.3 vendor/sinatra/test/sessions_test.rb
relevance-castronaut-0.4.4 vendor/sinatra/test/sessions_test.rb
relevance-castronaut-0.4.5 vendor/sinatra/test/sessions_test.rb
relevance-castronaut-0.4.6 vendor/sinatra/test/sessions_test.rb
relevance-castronaut-0.5.0 vendor/sinatra/test/sessions_test.rb
relevance-castronaut-0.5.1 vendor/sinatra/test/sessions_test.rb
relevance-castronaut-0.5.2 vendor/sinatra/test/sessions_test.rb
relevance-castronaut-0.5.3 vendor/sinatra/test/sessions_test.rb
relevance-castronaut-0.5.4 vendor/sinatra/test/sessions_test.rb
relevance-castronaut-0.6.0 vendor/sinatra/compat/sessions_test.rb
relevance-castronaut-0.6.1 vendor/sinatra/compat/sessions_test.rb
relevance-castronaut-0.7.4 vendor/sinatra/compat/sessions_test.rb
relevance-castronaut-0.7.5 vendor/sinatra/compat/sessions_test.rb
rtomayko-sinatra-0.3.0 test/sessions_test.rb
rtomayko-sinatra-0.3.1 test/sessions_test.rb
rtomayko-sinatra-0.3.2 test/sessions_test.rb