diff options
author | Dylan Griffith <dyl.griffith@gmail.com> | 2018-02-16 17:38:45 +1100 |
---|---|---|
committer | Dylan Griffith <dyl.griffith@gmail.com> | 2018-02-16 19:47:44 +1100 |
commit | bda4f0811e3d7f3530d1d6c338e2de6ada5bf1f2 (patch) | |
tree | 935b8b18311275a85dc2b069e90fb0a37b42a75d /spec/lib/gitlab/profiler_spec.rb | |
parent | 1192526b89f2a6a24bbe6a0abe12443450fef95d (diff) | |
download | gitlab-ce-update-profiler-docs-explaining-how-to-provide-user.tar.gz |
Improve error handling for Gitlab::Profiler and improve doc about providing a userupdate-profiler-docs-explaining-how-to-provide-user
Diffstat (limited to 'spec/lib/gitlab/profiler_spec.rb')
-rw-r--r-- | spec/lib/gitlab/profiler_spec.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/spec/lib/gitlab/profiler_spec.rb b/spec/lib/gitlab/profiler_spec.rb index 4a43dbb2371..f02b1cf55fb 100644 --- a/spec/lib/gitlab/profiler_spec.rb +++ b/spec/lib/gitlab/profiler_spec.rb @@ -53,6 +53,15 @@ describe Gitlab::Profiler do described_class.profile('/', user: user) end + context 'when providing a user without a personal access token' do + it 'raises an error' do + user = double(:user) + allow(user).to receive_message_chain(:personal_access_tokens, :active, :pluck).and_return([]) + + expect { described_class.profile('/', user: user) }.to raise_error('Your user must have a personal_access_token') + end + end + it 'uses the private_token for auth if both it and user are set' do user = double(:user) user_token = 'user' |