From 6d45909f03f6cc32f72135ce7ca7b4fd62132c15 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Thu, 15 May 2014 09:57:21 +0200 Subject: [PATCH] Add test for current behavior of current_user --- spec/requests/api/api_helpers_spec.rb | 5 +++++ 1 file changed, 5 insertions(+) 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