summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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