@@ -10,12 +10,12 @@ def app
1010 Web ::SessionsAPI
1111 end
1212
13- describe 'POST api/web/session /sign_in' do
13+ describe 'POST api/web/sessions /sign_in' do
1414 let ( :user ) { create ( :user , email : 'test@example.com' , password : 'password123' ) }
1515
1616 context 'with valid credentials' do
1717 it 'returns a JWT token' do
18- post '/web/session /sign_in' , { email : user . email , password : 'password123' }
18+ post '/web/sessions /sign_in' , { email : user . email , password : 'password123' }
1919
2020 expect ( last_response . status ) . to eq ( 200 )
2121 json = JSON . parse ( last_response . body )
@@ -26,7 +26,7 @@ def app
2626
2727 context 'with invalid credentials' do
2828 it 'returns an error message' do
29- post '/web/session /sign_in' , { email : user . email , password : 'wrong_password' }
29+ post '/web/sessions /sign_in' , { email : user . email , password : 'wrong_password' }
3030
3131 expect ( last_response . status ) . to eq ( 401 )
3232 json = JSON . parse ( last_response . body )
@@ -36,13 +36,13 @@ def app
3636 end
3737 end
3838
39- describe 'DELETE /api/web/session /sign_out' do
39+ describe 'DELETE /api/web/sessions /sign_out' do
4040 let ( :user ) { create ( :user ) }
4141 let ( :token ) { user . generate_jwt }
4242
4343 context 'with a valid token' do
4444 it 'returns a success response' do
45- delete '/web/session /sign_out' , { } , 'HTTP_AUTHORIZATION' => "Bearer #{ token } "
45+ delete '/web/sessions /sign_out' , { } , 'HTTP_AUTHORIZATION' => "Bearer #{ token } "
4646 expect ( last_response . status ) . to eq ( 200 )
4747 json = JSON . parse ( last_response . body )
4848 expect ( json [ 'success' ] ) . to eq ( true )
@@ -51,7 +51,7 @@ def app
5151
5252 context 'with an invalid token' do
5353 it 'returns an unauthorized response' do
54- delete '/web/session /sign_out' , { } , 'HTTP_AUTHORIZATION' => 'Bearer invalid_token'
54+ delete '/web/sessions /sign_out' , { } , 'HTTP_AUTHORIZATION' => 'Bearer invalid_token'
5555 expect ( last_response . status ) . to eq ( 401 )
5656 end
5757 end
0 commit comments