summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Vosmaer <contact@jacobvosmaer.nl>2014-05-15 09:57:21 +0200
committerJacob Vosmaer <contact@jacobvosmaer.nl>2014-05-15 09:57:21 +0200
commit6d45909f03f6cc32f72135ce7ca7b4fd62132c15 (patch)
tree08ee88801fa983f889ce7c6b83e978151796412a
parent961810a4427ed452a9557b3f4bbe5fa8a1f21229 (diff)
downloadgitlab-ce-6d45909f03f6cc32f72135ce7ca7b4fd62132c15.tar.gz
Add test for current behavior of current_user
-rw-r--r--spec/requests/api/api_helpers_spec.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/spec/requests/api/api_helpers_spec.rb b/spec/requests/api/api_helpers_spec.rb
index 6f961d321bd..2dcbce09b27 100644
--- a/spec/requests/api/api_helpers_spec.rb
+++ b/spec/requests/api/api_helpers_spec.rb
@@ -39,6 +39,11 @@ describe API, api: true do
end
describe ".current_user" do
+ it "should return nil for an invalid token" do
+ env[API::APIHelpers::PRIVATE_TOKEN_HEADER] = 'invalid token'
+ current_user.should be_nil
+ end
+
it "should leave user as is when sudo not specified" do
env[API::APIHelpers::PRIVATE_TOKEN_HEADER] = user.private_token
current_user.should == user