diff options
author | Martin Hanzel <mhanzel@gitlab.com> | 2019-06-10 21:15:14 +0200 |
---|---|---|
committer | Martin Hanzel <mhanzel@gitlab.com> | 2019-06-10 21:15:14 +0200 |
commit | dc29536f3539428a54ffdfdbe2921ff4da1f2d4e (patch) | |
tree | d8b9e0cbf4a9dfe522c301b68f47bc9df004350d /spec/controllers/application_controller_spec.rb | |
parent | eaac8810e6659964f60234c802ed44fa3da74d00 (diff) | |
parent | 502cbda11ba0c6d798b243ab6f489cd73c7bdeea (diff) | |
download | gitlab-ce-mh/mocks-doc.tar.gz |
Merge branch 'master' into mh/mocks-docmh/mocks-doc
Diffstat (limited to 'spec/controllers/application_controller_spec.rb')
-rw-r--r-- | spec/controllers/application_controller_spec.rb | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/spec/controllers/application_controller_spec.rb b/spec/controllers/application_controller_spec.rb index 5ecd1b6b7c8..40669ec5451 100644 --- a/spec/controllers/application_controller_spec.rb +++ b/spec/controllers/application_controller_spec.rb @@ -691,4 +691,38 @@ describe ApplicationController do end end end + + context 'Gitlab::Session' do + controller(described_class) do + prepend_before_action do + authenticate_sessionless_user!(:rss) + end + + def index + if Gitlab::Session.current + head :created + else + head :not_found + end + end + end + + it 'is set on web requests' do + sign_in(user) + + get :index + + expect(response).to have_gitlab_http_status(:created) + end + + context 'with sessionless user' do + it 'is not set' do + personal_access_token = create(:personal_access_token, user: user) + + get :index, format: :atom, params: { private_token: personal_access_token.token } + + expect(response).to have_gitlab_http_status(:not_found) + end + end + end end |