Sha256: 6f65d6402ae5efbeeaf8ea780115eedcb45804cb1f09db81854c378863f67af7

Contents?: true

Size: 670 Bytes

Versions: 6

Compression:

Stored size: 670 Bytes

Contents

require 'spec_helper'

describe SessionsController do
  let(:session_class) { ::ActionDispatch::Session::SequelStore.session_class }

  def login
    post '/session', :status => 'logged_in'
  end

  describe '#create' do
    it 'creates a new session' do
      expect do
        login
      end.to change { session_class.count }.from(0).to(1)
      expect(session[:status]).to eq 'logged_in'
    end
  end

  describe '#destroy' do
    before { login }
    it 'reset session' do
      old_session_id = cookies['_session_id']
      delete '/session'
      expect(old_session_id).not_to eq cookies['_session_id']
      expect(session[:status]).to be_nil
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
sequel-rails-0.9.5 spec/integration/sessions_controller_spec.rb
sequel-rails-0.9.4 spec/integration/sessions_controller_spec.rb
sequel-rails-0.9.3 spec/integration/sessions_controller_spec.rb
sequel-rails-0.9.2 spec/integration/sessions_controller_spec.rb
sequel-rails-0.9.1 spec/integration/sessions_controller_spec.rb
sequel-rails-0.9.0 spec/integration/sessions_controller_spec.rb