|
6 | 6 | let(:password) { '12345678' } |
7 | 7 | let(:user) { create(:user, :confirmed, password: password) } |
8 | 8 | let(:query) do |
9 | | - <<~GRAPHQL |
| 9 | + <<-GRAPHQL |
10 | 10 | mutation { |
11 | 11 | login( |
12 | 12 | email: "#{user.email}", |
|
27 | 27 | it 'return credentials in headers and user information' do |
28 | 28 | expect(response).to include_auth_headers |
29 | 29 | expect(user.reload.tokens.keys).to include(response.headers['client']) |
30 | | - expect(json_response.dig(:data, :login)).to match( |
| 30 | + expect(json_response[:data][:login]).to match( |
31 | 31 | success: true, |
32 | 32 | errors: [], |
33 | 33 | authenticable: { email: user.email } |
|
40 | 40 |
|
41 | 41 | it 'returns bad credentials error' do |
42 | 42 | expect(response).not_to include_auth_headers |
43 | | - expect(json_response.dig(:data, :login)).to match( |
| 43 | + expect(json_response[:data][:login]).to match( |
44 | 44 | success: false, |
45 | 45 | errors: ['Invalid login credentials. Please try again.'], |
46 | 46 | authenticable: nil |
|
54 | 54 |
|
55 | 55 | it 'returns a must confirm account message' do |
56 | 56 | expect(response).not_to include_auth_headers |
57 | | - expect(json_response.dig(:data, :login)).to match( |
| 57 | + expect(json_response[:data][:login]).to match( |
58 | 58 | success: false, |
59 | 59 | errors: [ |
60 | 60 | "A confirmation email was sent to your account at '#{user.email}'. You must follow the instructions in the " \ |
|
70 | 70 |
|
71 | 71 | it 'returns a must confirm account message' do |
72 | 72 | expect(response).not_to include_auth_headers |
73 | | - expect(json_response.dig(:data, :login)).to match( |
| 73 | + expect(json_response[:data][:login]).to match( |
74 | 74 | success: false, |
75 | 75 | errors: ['Your account has been locked due to an excessive number of unsuccessful sign in attempts.'], |
76 | 76 | authenticable: nil |
|
83 | 83 |
|
84 | 84 | it 'returns a must confirm account message' do |
85 | 85 | expect(response).not_to include_auth_headers |
86 | | - expect(json_response.dig(:data, :login)).to match( |
| 86 | + expect(json_response[:data][:login]).to match( |
87 | 87 | success: false, |
88 | 88 | errors: ['Invalid login credentials. Please try again.' ], |
89 | 89 | authenticable: nil |
|
0 commit comments