Use expect for nested params in auth/setup#update (#33657)

This commit is contained in:
Matt Jankowski 2025-01-21 03:16:40 -05:00 committed by GitHub
parent 7543c90642
commit 45149cd5e1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 1 deletions

View File

@ -35,6 +35,6 @@ class Auth::SetupController < ApplicationController
end end
def user_params def user_params
params.require(:user).permit(:email) params.expect(user: [:email])
end end
end end

View File

@ -24,4 +24,15 @@ RSpec.describe 'Auth Setup' do
end end
end end
end end
describe 'PUT /auth/setup' do
before { sign_in Fabricate(:user, confirmed_at: nil) }
it 'gracefully handles invalid nested params' do
put '/auth/setup?user=invalid'
expect(response)
.to have_http_status(400)
end
end
end end