return empty email if not current user

This commit is contained in:
Rimian Perkins 2019-09-13 12:58:17 +10:00
parent 63ea563553
commit 7f7bd52552
2 changed files with 2 additions and 2 deletions

View File

@ -5,7 +5,7 @@ module DiscoursePatrons
skip_before_action :verify_authenticity_token, only: [:create] skip_before_action :verify_authenticity_token, only: [:create]
def index def index
result = {} result = { email: '' }
if current_user if current_user
result[:email] = current_user.email result[:email] = current_user.email

View File

@ -23,7 +23,7 @@ module DiscoursePatrons
it 'has no current user email' do it 'has no current user email' do
get :index, format: :json get :index, format: :json
expect(JSON.parse(response.body)['email']).to be_nil expect(JSON.parse(response.body)['email']).to be_empty
end end
end end