This is the 18th video in the Getting Started with Rails 7 series. In this video Mike adds the ability to delete comments. Similar to article deletion, he needs to make sure the Turbo confirm and :see_other status are configured correctly. In order to test this he uses browser-driven Rails system tests.
This video covers:
- 00:00:10 Introduction and set up spam comment
- 00:02:08 Add destroy link to comment partial (not yet adapted for Turbo)
- 00:03:17 Add assertions to ArticlesControllerTest for show action
- 00:04:08 Write failing browser test case for destroying a comment (with invalid match: :last option)
- 00:05:58 Add should destroy comment test to CommentsControllerTest
- 00:07:47 Try to run the tests and fix syntax error
- 00:09:02 Troubleshoot invalid match: :last part 1
- 00:11:48 Adapt link_to so it works with Turbo and get articles show test passing
- 00:14:41 Implement the destroy action on the CommentsController to get comments destroy test passing
- 00:18:55 Troubleshoot invalid match in browser test part 2.
- 00:23:38 Add dom_id helper to comment partial to identify the comment to destroy
- 00:26:42 Validate user experience in browser
- 00:27:15 Review, commit, and push code
The code for this series is open source and available on GitHub. View the commit for this video here.