Test that page requires authentication in Rails
11 March 2022 (Updated 24 April 2022)
Suppose you’re using Devise to implement authentication. You have the usual before action hooks to authentication controller actions. But, how do you test that a given route has the authentication check in place. Here’s an approach:
Write custom require_authentication
matcher
Use custom matcher
Tagged:
Rails testing
Thanks for your comment 🙏. Once it's approved, it will appear here.
Leave a comment