Add test for current behavior of current_user

This commit is contained in:
Jacob Vosmaer 2014-05-15 09:57:21 +02:00
parent 961810a442
commit 6d45909f03
1 changed files with 5 additions and 0 deletions

View File

@ -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