Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/channels/application_cable/connection_spec.rb')
-rw-r--r--spec/channels/application_cable/connection_spec.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/spec/channels/application_cable/connection_spec.rb b/spec/channels/application_cable/connection_spec.rb
index 4943669bde0..fa2518e1970 100644
--- a/spec/channels/application_cable/connection_spec.rb
+++ b/spec/channels/application_cable/connection_spec.rb
@@ -43,6 +43,16 @@ RSpec.describe ApplicationCable::Connection, :clean_gitlab_redis_sessions do
end
end
+ context 'when bearer header is provided' do
+ let(:user_pat) { create(:personal_access_token) }
+
+ it 'finds user by PAT' do
+ connect(ActionCable.server.config.mount_path, headers: { Authorization: "Bearer #{user_pat.token}" })
+
+ expect(connection.current_user).to eq(user_pat.user)
+ end
+ end
+
context 'when session cookie is not set' do
it 'sets current_user to nil' do
connect