Commit 6d45909f03f6cc32f72135ce7ca7b4fd62132c15
1 parent
961810a4
Exists in
spb-stable
and in
2 other branches
Add test for current behavior of current_user
Showing
1 changed file
with
5 additions
and
0 deletions
Show diff stats
spec/requests/api/api_helpers_spec.rb
@@ -39,6 +39,11 @@ describe API, api: true do | @@ -39,6 +39,11 @@ describe API, api: true do | ||
39 | end | 39 | end |
40 | 40 | ||
41 | describe ".current_user" do | 41 | describe ".current_user" do |
42 | + it "should return nil for an invalid token" do | ||
43 | + env[API::APIHelpers::PRIVATE_TOKEN_HEADER] = 'invalid token' | ||
44 | + current_user.should be_nil | ||
45 | + end | ||
46 | + | ||
42 | it "should leave user as is when sudo not specified" do | 47 | it "should leave user as is when sudo not specified" do |
43 | env[API::APIHelpers::PRIVATE_TOKEN_HEADER] = user.private_token | 48 | env[API::APIHelpers::PRIVATE_TOKEN_HEADER] = user.private_token |
44 | current_user.should == user | 49 | current_user.should == user |