forked from chatwoot/chatwoot
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Chore: Include avatar url in sign_in response (chatwoot#501)
- include avatar url in sign_in response ( fixes chatwoot#500 ) - fix circle ci builds
- Loading branch information
1 parent
eb51859
commit 77473dc
Showing
4 changed files
with
54 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
json.data do | ||
json.id @resource.id | ||
json.provider @resource.provider | ||
json.uid @resource.uid | ||
json.name @resource.name | ||
json.nickname @resource.nickname | ||
json.email @resource.email | ||
json.account_id @resource.account_id | ||
json.pubsub_token @resource.pubsub_token | ||
json.role @resource.role | ||
json.inviter_id @resource.inviter_id | ||
json.confirmed @resource.confirmed? | ||
json.avatar_url @resource.avatar_url | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
require 'rails_helper' | ||
|
||
RSpec.describe 'Session', type: :request do | ||
describe 'GET /sign_in' do | ||
let!(:account) { create(:account) } | ||
|
||
context 'when it is invalid credentials' do | ||
it 'returns unauthorized' do | ||
params = { email: '[email protected]', password: 'invalid' } | ||
|
||
post new_user_session_url, | ||
params: params, | ||
as: :json | ||
expect(response).to have_http_status(:unauthorized) | ||
expect(response.body).to include('Invalid login credentials') | ||
end | ||
end | ||
|
||
context 'when it is valid credentials' do | ||
let!(:user) { create(:user, password: 'test1234', account: account) } | ||
|
||
it 'returns successful auth response' do | ||
params = { email: user.email, password: 'test1234' } | ||
|
||
post new_user_session_url, | ||
params: params, | ||
as: :json | ||
|
||
expect(response).to have_http_status(:success) | ||
expect(response.body).to include(user.email) | ||
end | ||
end | ||
end | ||
end |