Testing authentication in Rails with Minitest
Chapter 12 of the free Minitest Rails guide is live: https://minitestrails.com/guide/testing-authentication/
Until now, the Cookbook app let anyone create, edit, and destroy recipes. This chapter catches the app up to how real apps work, while keeping the same testing habits you’ve already been using.
What this chapter adds:
- Rails 8 generate authentication (users, sessions, sign-in, password reset)
- Integration and system test coverage for sign in and sign out
- Session helpers (sign_in_as for HTTP tests, sign_in_to_ui_as for the browser)
- Read-only access for guests (browse list/show; writes redirect to sign-in)
- Password reset request and update coverage (integration + system smoke)
Post a comment