Unit Test: Format Validation
Explore writing unit tests to enforce format validation in Rails, restricting inputs to letters and spaces. Understand how to define these tests, handle validation failures, and consider edge cases for robust code quality.
We'll cover the following...
We'll cover the following...
Defining the test
This unit test restricts the name field to only contain letters and spaces. To define this one, we’ll set a name containing an emoji character on the user and assert validation failure.
Here’s the test:
Add ...