aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Lemon <y@yulqen.org>2024-12-15 17:34:42 +0000
committerMatthew Lemon <y@yulqen.org>2024-12-15 17:34:42 +0000
commit9cf165cb4bbaa15fc0c1ba7286e4ce0b723ceae4 (patch)
treecffd73b65537163e2999566d240bc46abd986680
parentf1d04d1390ac0e755e6ac4778927bf06c86e9ba3 (diff)
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.
-rw-r--r--app/controllers/sessions_controller.rb2
-rw-r--r--test/controllers/resource_types_controller_test.rb2
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