Complete the code to define an integration test class inheriting from the correct base class.
class UsersLoginTest < [1] # test code here end
Integration tests in Rails inherit from ActionDispatch::IntegrationTest to simulate user interactions across multiple controllers.
Complete the code to simulate a GET request to the login path in an integration test.
get [1]To test the login page, the GET request should be sent to login_path.
Fix the error in the assertion to check if the login form is present in the response body.
assert_select "form[action=?]", [1]
The login form's action attribute should point to login_path to submit the login credentials.
Fill both blanks to simulate a POST login request with email and password parameters.
post login_path, params: { session: { email: [1], password: [2] } }The POST request should send the correct email and password as strings in the params hash.
Fill both blanks to check that after login, the user is redirected to the profile page and the flash message is not empty.
assert_redirected_to [1] follow_redirect! assert_template [2] assert_not flash.empty?
After login, the user should be redirected to their profile page using user_path(@user). The template rendered is :users/show. The flash message should not be empty to confirm feedback.