Putting Tests and Other Quality Checks in the bin/ci command

Learn about the quality checks and testing procedures within our Rails application.

In the output of bin/setup help, we saw a reference to bin/ci, which is what we’ll create now. This script runs whatever tests and quality checks the app might need and is named ci for continuous integration. Once this script is created, we should be able to configure our CI environment to use bin/setup and bin/ci as our entire check. This is also where we can run bin/setup twice in a row to make sure it’s idempotent. This is the key to ensuring our bin/setup stays working, even if developers don’t use it every day.

bin/setup # perform the actual setup
bin/setup # ensure setup is idempotent
bin/ci    # perform all checks

Automated security checks

We already have bin/rails test and bin/rails test:system to run our application’s tests. Beyond these, we want to automate some security vulnerability checks as well. Because we have not written any code yet, we should not have any security issues.

By setting up an automated check now, we make it much easier to avoid introducing known issues into the codebase in the future. This sort of policy as automation can be hugely impactful for keeping a team consistent in their approach to best practices.

BrakemanBrakeman is a free vulnerability scanner specifically designed for Ruby on Rails applications. can perform audits on the code we write, and Bundler can audit our dependencies, though it requires the bundler-audit gem. Let’s install both now.

Get hands-on with 1400+ tech skills courses.