Sha256: 624aa4a33daf61fc87902aad4dea7be09abf018365f1696262af1a8ea1ab2a03

Contents?: true

Size: 762 Bytes

Versions: 2

Compression:

Stored size: 762 Bytes

Contents

require 'spec_helper'
require 'cuba_api/allow_session_rack'

describe CubaApi::AllowSessionRack do

  before do
    Cuba.reset!
    Cuba.use CubaApi::AllowSessionRack, 'session', 'system'
    Cuba.use Rack::Session::Cookie, :secret => 'secret'
    Cuba.define do
      on 'session' do
        session[ 'name' ] = :me
      end
    end
  end

  it 'allows session' do
     _, headers, _ = Cuba.call( { 'PATH_INFO' => '/session',
                                  'SCRIPT_NAME' => '/session' } )

    headers[ 'Set-Cookie' ].must_not.eq nil
  end

  it 'does NOT allows session' do
     _, headers, _ = Cuba.call( { 'PATH_INFO' => '/something',
                                  'SCRIPT_NAME' => '/something' } )

    headers[ 'Set-Cookie' ].must.eq nil
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cuba-api-0.6.1 spec/allow_session_rack_spec.rb
cuba-api-0.6.0 spec/allow_session_rack_spec.rb