Implementing a Basic Confidence-Checking System
Learn to implement a basic confidence-checking system in our application on how to avoid duplicative tests for our Rails application.
We'll cover the following...
We could just throw #CONFIDENCE CHECK before these assertions, but we don’t think this sort of code comment is nearly as useful as actual code. Let’s make a method that will indicate which assertions are checking that we can run our test and which assertions are the actual test.
We’ll do that by assuming the existence of a method called confidence_check that takes a block and executes the code inside that block.
Now, the test makes it clear that refute_nil and assert_redirected_to are only there to double-check that the basics are working before we do the real assertion, which follows.
In addition to demarcating the code, we need to see a helpful error in our test output, letting us know that the test effectively wasn’t even run because of factors ...