Sha256: cdfd13914a08f0e6e572daabfdc912cdd511a28ec6d2954776c55d8083fc0f6a

Contents?: true

Size: 765 Bytes

Versions: 19

Compression:

Stored size: 765 Bytes

Contents

require_relative "spec_helper"

describe "session handling" do
  include CookieJar

  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.must_match("You're missing a session handler, try using the sessions plugin.")
  end

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

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

    _, h, b = req
    b.join.must_equal 'ab'
    _, h, b = req
    b.join.must_equal 'abb'
    _, h, b = req
    b.join.must_equal 'abbb'
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
roda-3.27.0 spec/session_spec.rb
roda-3.26.0 spec/session_spec.rb
roda-3.25.0 spec/session_spec.rb
roda-3.24.0 spec/session_spec.rb
roda-3.23.0 spec/session_spec.rb
roda-3.22.0 spec/session_spec.rb
roda-3.21.0 spec/session_spec.rb
roda-3.20.0 spec/session_spec.rb
roda-3.19.0 spec/session_spec.rb
roda-3.18.0 spec/session_spec.rb
roda-3.17.0 spec/session_spec.rb
roda-3.16.0 spec/session_spec.rb
roda-3.15.0 spec/session_spec.rb
roda-3.14.1 spec/session_spec.rb
roda-3.14.0 spec/session_spec.rb
roda-3.13.0 spec/session_spec.rb
roda-3.12.0 spec/session_spec.rb
roda-3.11.0 spec/session_spec.rb
roda-3.10.0 spec/session_spec.rb