Getting Started with Rails 7 Episode 19: Basic Auth Part 1

Articles page with basic authentication dialog box.

This is the 19th video in the Getting Started with Rails 7 series. In this video Mike starts the section on basic authentication and gets it working. Then he tries and does not (yet) succeed in getting the browser tests working with basic auth.

This video covers:

  • 00:00:10 Introduction and review
  • 00:05:07 Adapt ArticlesControllerTest for authenticated and unauthenticated user scenarios
  • 00:13:20 Implement basic auth in ArticlesController
  • 00:15:15 Validate behavior in UI
  • 00:16:17 Fix failures in ArticlesControllerTest due to incorrect hash structure on update action
  • 00:18:29 Adapt CommentsdControllerTest for authenticated and unauthenticated user scenarios and add auth to CommentsController
  • 00:20:38 Try to get browser tests to work with Basic Authentication
  • 00:45:36 To be continued…

Notes:

  • As pointed out by Rails From Zero in the YouTube comments for the video, adding the debugger command to the in the test would have allowed us to pause the code and examine the current state (both in IRB and in the JavaScript console). This would have made debugging more efficient.
  • Trying to get the browser tests to work with Basic Auth was not a smooth process. We leave the mistakes and troubleshooting in the videos on purpose because you can still learn from when things don’t go well. See Why Leave Mistakes in the Videos for more.

The code for this series is open source and available on GitHub. View the commit for this video here.


Leave a Reply