From 1b03222260bd93fb41f7a48ff3b01cf906a73dc7 Mon Sep 17 00:00:00 2001 From: zmagod Date: Thu, 5 Oct 2017 10:24:28 +0200 Subject: [PATCH] adds tests for sign_out_user action on users controller --- .../client_api/users/users_controller_spec.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/spec/controllers/client_api/users/users_controller_spec.rb b/spec/controllers/client_api/users/users_controller_spec.rb index c23d17658..5a41ee6ce 100644 --- a/spec/controllers/client_api/users/users_controller_spec.rb +++ b/spec/controllers/client_api/users/users_controller_spec.rb @@ -7,6 +7,20 @@ describe ClientApi::Users::UsersController, type: :controller do @user = User.first end + describe '#sign_out_user' do + it 'returns unauthorized response' do + sign_out @user + get :sign_out_user, format: :json + expect(response).to have_http_status(:unauthorized) + end + + it 'responds successfully if the user is signed out' do + get :sign_out_user, format: :json + expect(response).to have_http_status(:ok) + expect(subject.current_user).to eq(nil) + end + end + describe 'GET current_user_info' do it 'responds successfully' do get :current_user_info, format: :json