Sha256: 2c6d148d476bc82adff8fe11808cd1cf2b76c8f54561a9a94b54f4202a383e70

Contents?: true

Size: 831 Bytes

Versions: 20

Compression:

Stored size: 831 Bytes

Contents

require File.expand_path("spec_helper", File.dirname(__FILE__))

describe "session handling" do
  it "should give a warning if session variable is not available" do
    app do |r|
      begin
        session
      rescue Exception => e
        e.message
      end
    end

    body.should =~ /use Rack::Session::Cookie/
  end

  it "should return session if available" do
    app(:bare) do
      use Rack::Session::Cookie, :secret=>'1'

      route do |r|
        r.on do
          (session[1] ||= 'a') << 'b'
          session[1]
        end
      end
    end

    _, h, b = req
    b.join.should == 'ab'
    _, h, b = req('HTTP_COOKIE'=>h['Set-Cookie'].sub("; path=/; HttpOnly", ''))
    b.join.should == 'abb'
    _, h, b = req('HTTP_COOKIE'=>h['Set-Cookie'].sub("; path=/; HttpOnly", ''))
    b.join.should == 'abbb'
  end
end

Version data entries

20 entries across 20 versions & 2 rubygems

Version Path
roda-2.2.0 spec/session_spec.rb
roda-2.1.0 spec/session_spec.rb
roda-2.0.0 spec/session_spec.rb
roda-1.3.0 spec/session_spec.rb
roda-1.2.0 spec/session_spec.rb
roda-1.1.0 spec/session_spec.rb
roda-cj-1.0.5 spec/session_spec.rb
roda-cj-1.0.4 spec/session_spec.rb
roda-cj-1.0.3 spec/session_spec.rb
roda-cj-1.0.2 spec/session_spec.rb
roda-cj-1.0.1 spec/session_spec.rb
roda-cj-1.0.0 spec/session_spec.rb
roda-1.0.0 spec/session_spec.rb
roda-cj-0.9.6 spec/session_spec.rb
roda-cj-0.9.5 spec/session_spec.rb
roda-cj-0.9.4 spec/session_spec.rb
roda-cj-0.9.3 spec/session_spec.rb
roda-cj-0.9.2 spec/session_spec.rb
roda-cj-0.9.1 spec/session_spec.rb
roda-0.9.0 spec/session_spec.rb