@StatelessCode
  @StatelessCode
Stateless Code | Codecast: Getting Started with Rails 7 17: Refactor Tests @StatelessCode | Uploaded January 2022 | Updated October 2024, 4 hours ago.
This is the 17th video in the Getting Started with Rails 7 series. In this video Mike refactors the existing tests to move shared tests between models to a helper module that both test classes include. In addition, he creates a method to test that all fixtures are valid for each model. After that, he moves some of the repeated controller assertions into private methods.

This video covers:
00:00:10 Introduction and review
00:02:17 Add method to test_helper that checks validity of fixtures for a given model
00:08:16 Create, require, and include shared test support module for Visible concern behavior
00:12:39 Start moving status setup code to VisibleTestHelpers module
00:14:57 Move shared tests to included block in helper module
00:18:23 Refactor test model object creation into private methods
00:24:33 Make shared tests in helper module general enough to work for both models
00:30:58 Refactor out repeated assertions in ArticlesControllerTest
00:34:32 Review, commit, and push code

This video is CC0 - No rights reserved. (YouTube doesn't allow this option when publishing.) All code is released under the UNLICENSE. Stateless Code denies the concept of "intellectual property". Copying is not stealing.
Codecast: Getting Started with Rails 7 17: Refactor TestsCodecast: Getting Started with Rails 7 12: Add a Model and Route for CommentsCodecast: Create a RubyGem 85: Release Version 0.4.0!Codecast: Create a RubyGem 84: Update Docs and Extend ConvenienceMethods into NerdDice, MergeWrite System Tests for Devise Cancel My Account and Get Working With TurboStateless Code Video 204Codecast: statelesscode.com WordPress 04: Initial Push and Backlog SetupWrite Tests for User Locking and Unlocking and Finish the Devise EpicCodecast: statelesscode.com WordPress 06: Main Content Margins, YouTube Embeds, and EnlighterCodecast: statelesscode.com WordPress 08: Start on Sidebar and Footer and Use Tailwind DirectivesWhy Rails in the 2020s?Create a RubyGem 90: Fix README to Use Relative Links Instead of Absolute Links

Codecast: Getting Started with Rails 7 17: Refactor Tests @StatelessCode

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER