Validate uniqueness of Active Record attribute
11 March 2022 (Updated 24 April 2022)
Assuming, you have RSpec and Shoulda Matchers installed, you can add the following test:
To make test pass, you’d include the following in the User
model:
Sources
Tagged:
Rails testing
Thanks for your comment . Once it's approved, it will appear here.
Leave a comment