Files
fizzy/test/controllers/signup/completions_controller_test.rb
T
Mike Dalessio b75d2ae6d8 Validate User name presence and handle blank names gracefully
Addresses an issue where User#familiar_name assumed `name` was always
present, potentially raising an exception during view rendering. Now
User validates name presence, and User#familiar_name handles blank
strings without error, in case any existing invalid records exist.
2025-12-16 10:44:10 -05:00

47 lines
975 B
Ruby

require "test_helper"
class Signup::CompletionsControllerTest < ActionDispatch::IntegrationTest
setup do
@signup = Signup.new(email_address: "newuser@example.com", full_name: "New User")
@signup.create_identity || raise("Failed to create identity")
sign_in_as @signup.identity
end
test "new" do
untenanted do
get new_signup_completion_path
end
assert_response :success
end
test "create" do
untenanted do
post signup_completion_path, params: {
signup: {
full_name: @signup.full_name
}
}
end
assert_response :redirect, "Valid params should redirect"
end
test "create with blank name" do
untenanted do
post signup_completion_path, params: {
signup: {
full_name: ""
}
}
end
assert_response :unprocessable_entity
assert_select ".txt-negative" do
assert_select "li", text: "Full name can't be blank"
end
end
end