Sha256: 0c3b0c76870d217e55cd4108ce8c108c082c66be8aebf3d10932f7008ad0a962
Contents?: true
Size: 1.05 KB
Versions: 5
Compression:
Stored size: 1.05 KB
Contents
require 'spec_helper' describe 'session key assignment' do context 'user signs in' do before do @user = create(:user) do_post session_path, params: { session: { email: @user.email, password: @user.password } } end it 'sets user session token' do @user.reload expect(@user.session_token).to_not be_nil end it 'sets session token in cookie' do expect(cookies['authenticate_session_token']).to_not be_nil end it 'sets current_user' do expect(controller.current_user).to eq(@user) end context 'user signs out' do it 'rotates user session token' do old_session = @user.session_token do_get sign_out_path @user.reload expect(@user.session_token).to_not eq old_session end it 'removes session cookie' do do_get sign_out_path expect(cookies['authenticate_session_token']).to eq '' end it 'sets current_user to nil' do do_get sign_out_path expect(controller.current_user).to be_nil end end end end
Version data entries
5 entries across 5 versions & 1 rubygems