|
13 | 13 | password: "#{password}" |
14 | 14 | ) { |
15 | 15 | user { email name signInCount } |
16 | | - success |
17 | | - errors |
18 | 16 | } |
19 | 17 | } |
20 | 18 | GRAPHQL |
|
28 | 26 | expect(response).to include_auth_headers |
29 | 27 | expect(user.reload.tokens.keys).to include(response.headers['client']) |
30 | 28 | expect(json_response[:data][:userLogin]).to match( |
31 | | - success: true, |
32 | | - errors: [], |
33 | | - user: { email: user.email, name: user.name, signInCount: 1 } |
| 29 | + user: { email: user.email, name: user.name, signInCount: 1 } |
34 | 30 | ) |
| 31 | + expect(json_response[:errors]).to be_nil |
35 | 32 | end |
36 | 33 | end |
37 | 34 |
|
|
40 | 37 |
|
41 | 38 | it 'returns bad credentials error' do |
42 | 39 | expect(response).not_to include_auth_headers |
43 | | - expect(json_response[:data][:userLogin]).to match( |
44 | | - success: false, |
45 | | - errors: ['Invalid login credentials. Please try again.'], |
46 | | - user: nil |
| 40 | + expect(json_response[:data][:userLogin]).to be_nil |
| 41 | + expect(json_response[:errors]).to contain_exactly( |
| 42 | + hash_including(message: 'Invalid login credentials. Please try again.', extensions: { code: 'USER_ERROR' }) |
47 | 43 | ) |
48 | 44 | end |
49 | 45 | end |
|
54 | 50 |
|
55 | 51 | it 'returns a must confirm account message' do |
56 | 52 | expect(response).not_to include_auth_headers |
57 | | - expect(json_response[:data][:userLogin]).to match( |
58 | | - success: false, |
59 | | - errors: [ |
60 | | - "A confirmation email was sent to your account at '#{user.email}'. You must follow the instructions in the " \ |
61 | | - "email before your account can be activated" |
62 | | - ], |
63 | | - user: nil |
| 53 | + expect(json_response[:data][:userLogin]).to be_nil |
| 54 | + expect(json_response[:errors]).to contain_exactly( |
| 55 | + hash_including( |
| 56 | + message: "A confirmation email was sent to your account at '#{user.email}'. You must follow the " \ |
| 57 | + "instructions in the email before your account can be activated", |
| 58 | + extensions: { code: 'USER_ERROR' } |
| 59 | + ) |
64 | 60 | ) |
65 | 61 | end |
66 | 62 | end |
|
70 | 66 |
|
71 | 67 | it 'returns a must confirm account message' do |
72 | 68 | expect(response).not_to include_auth_headers |
73 | | - expect(json_response[:data][:userLogin]).to match( |
74 | | - success: false, |
75 | | - errors: ['Your account has been locked due to an excessive number of unsuccessful sign in attempts.'], |
76 | | - user: nil |
| 69 | + expect(json_response[:data][:userLogin]).to be_nil |
| 70 | + expect(json_response[:errors]).to contain_exactly( |
| 71 | + hash_including( |
| 72 | + message: 'Your account has been locked due to an excessive number of unsuccessful sign in attempts.', |
| 73 | + extensions: { code: 'USER_ERROR' } |
| 74 | + ) |
77 | 75 | ) |
78 | 76 | end |
79 | 77 | end |
|
83 | 81 |
|
84 | 82 | it 'returns a must confirm account message' do |
85 | 83 | expect(response).not_to include_auth_headers |
86 | | - expect(json_response[:data][:userLogin]).to match( |
87 | | - success: false, |
88 | | - errors: ['Invalid login credentials. Please try again.'], |
89 | | - user: nil |
| 84 | + expect(json_response[:data][:userLogin]).to be_nil |
| 85 | + expect(json_response[:errors]).to contain_exactly( |
| 86 | + hash_including(message: 'Invalid login credentials. Please try again.', extensions: { code: 'USER_ERROR' }) |
90 | 87 | ) |
91 | 88 | end |
92 | 89 | end |
|
0 commit comments