diff options
Diffstat (limited to 'spec/requests/application_controller_spec.rb')
-rw-r--r-- | spec/requests/application_controller_spec.rb | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/spec/requests/application_controller_spec.rb b/spec/requests/application_controller_spec.rb index 52fdf6bc69e..969fdbe9838 100644 --- a/spec/requests/application_controller_spec.rb +++ b/spec/requests/application_controller_spec.rb @@ -5,11 +5,33 @@ require 'spec_helper' RSpec.describe ApplicationController, type: :request, feature_category: :shared do let_it_be(:user) { create(:user) } - before do - sign_in(user) - end - it_behaves_like 'Base action controller' do + before do + sign_in(user) + end + subject(:request) { get root_path } end + + describe 'session expiration' do + context 'when user is authenticated' do + it 'does not set the expire_after option' do + sign_in(user) + + get root_path + + expect(request.env['rack.session.options'][:expire_after]).to be_nil + end + end + + context 'when user is unauthenticated' do + it 'sets the expire_after option' do + get root_path + + expect(request.env['rack.session.options'][:expire_after]).to eq( + Settings.gitlab['unauthenticated_session_expire_delay'] + ) + end + end + end end |