Sha256: bfa7b72a2624001b8eed95faf8e8855f7e20ace51d7c4af5584cf3a4fa79c601

Contents?: true

Size: 862 Bytes

Versions: 6

Compression:

Stored size: 862 Bytes

Contents

require 'spec/helper'

class SpecSession
  Innate.node('/').provide(:html, :None)

  def index
    'No session here'
  end

  def init
    session[:counter] = 0
  end

  def view
    session[:counter]
  end

  def increment
    session[:counter] += 1
  end

  def decrement
    session[:counter] -= 1
  end

  def reset
    session.clear
  end
end

describe Innate::Session do
  behaves_like :mock

  should 'initiate session as needed' do
    get '/'
    last_response.body.should == 'No session here'
    last_response['Set-Cookie'].should == nil

    get('/init')
    last_response.body.should == '0'

    1.upto(10) do |n|
      get('/increment').body.should == n.to_s
    end

    get('/reset')
    get('/view').body.should == ''
    get('/init').body.should == '0'

    -1.downto(-10) do |n|
      get('/decrement').body.should == n.to_s
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
manveru-innate-2009.04.18 spec/innate/session.rb
manveru-innate-2009.04 spec/innate/session.rb
manveru-innate-2009.05 spec/innate/session.rb
innate-2009.04 spec/innate/session.rb
innate-2009.04.12 spec/innate/session.rb
innate-2009.05 spec/innate/session.rb