From 9cf165cb4bbaa15fc0c1ba7286e4ce0b723ceae4 Mon Sep 17 00:00:00 2001 From: Matthew Lemon Date: Sun, 15 Dec 2024 17:34:42 +0000 Subject: Simplify session param structure in tests and controller. Fixes bug with passing the password Replaced nested session hash with direct email and password params in test setup, aligning with the updated `SessionsController`. This ensures consistency between test code and actual implementation. --- app/controllers/sessions_controller.rb | 2 +- test/controllers/resource_types_controller_test.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index 185dfeb..2a15e38 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -6,7 +6,7 @@ class SessionsController < ApplicationController end def create - if user = User.authenticate_by(params.permit(:email_address, :password)) + if (user = User.authenticate_by(params.permit(:email_address, :password))) start_new_session_for user redirect_to after_authentication_url else diff --git a/test/controllers/resource_types_controller_test.rb b/test/controllers/resource_types_controller_test.rb index a5ba2a3..c04a258 100644 --- a/test/controllers/resource_types_controller_test.rb +++ b/test/controllers/resource_types_controller_test.rb @@ -4,7 +4,7 @@ class ResourceTypesControllerTest < ActionDispatch::IntegrationTest setup do @resource_type = resource_types(:one) @user = users(:one) - post session_url, params: { session: { email_address: @user.email_address, password_digest: "password" } } + post session_url, params: { email_address: @user.email_address, password: "password" } follow_redirect! # After login end -- cgit v1.2.3