This is the 10th video in the Getting Started with Rails 7 series. In this video Mike follows the Getting Started with Rails guide to implement the destroy
action for Articles, but it doesn’t work as intended (even though the controller tests are passing). He then tracks down some recent changes to the Markdown for the Getting Started Guide in Rails main and uses the updated version of the getting started guide to get it working with Turbo without Rails Unobtrusive JavaScript.
Mike also makes use of a Rails system test inheriting from ApplicationSystemTestCase
that uses Selenium and Chrome to test the Turbo JavaScript interactions in the browser.
This video covers:
- 00:00:10 Introduction, review previous episodes and overview of intent for this episode
- 00:05:34 Write failing tests for
destroy
action and changes toshow
- 00:08:12 Add
destroy
action (guide version) toArticlesController
and iterate to getdestroy
test passing - 00:09:58 Add destroy link to
show.html.erb
to getshow
test passing - 00:10:41 Tests passing. Everything is fine. Or is it? Attempt to test in the browser and discover it is not working as intended.
- 00:12:26 Chase down solution to problem in rails/main version of getting started guide
- 00:16:31 Update
show.html.erb
to useturbo_method
andturbo_confirm
inlink_to
helper - 00:17:24 Update
destroy
action to redirect with status code303 :see_other
. Action now working as intended - 00:19:46 Use a Rails system test driven by a browser to test Turbo confirm and redirect working as intended
- 00:23:38 Troubleshoot getting test case working on Ubuntu. Install Chrome using .deb file to get it working
- 00:25:53 Configuration working. Fix incorrect assertion name in test case and get test passing.
- 00:26:28 Temporarily remove Turbo compliant version of code to demonstrate system tests failing and then incrementally add back in
- 00:29:07 View screenshots of system test case failures in
tmp/screenshots
folder of project directory - 00:29:59 Review, commit, and push code
The code for this series is open source and available on GitHub. View the commit for this video here.