spec/token/token_spec.rb in apicasso-0.6.0 vs spec/token/token_spec.rb in apicasso-0.6.1
- old
+ new
@@ -316,7 +316,25 @@
delete '/api/v1/used_model/' + id_to_del, headers: access_token
expect(response).to have_http_status(:no_content)
expect(UsedModel.all.size).to eq(size_before - 1)
end
end
+
+ context 'with a false key' do
+ access_token = { 'AUTHORIZATION' => "Token token=notavalidtoken" }
+
+ it 'returns unauthorized to request' do
+ get '/api/v1/used_model', headers: access_token
+ expect(response).to have_http_status(:unauthorized)
+ end
+ end
+
+ context 'with an empty key' do
+ access_token = { 'AUTHORIZATION' => "Token token=" }
+
+ it 'returns unauthorized to request' do
+ get '/api/v1/used_model', headers: access_token
+ expect(response).to have_http_status(:unauthorized)
+ end
+ end
end
end