Ruby on Rails 8 cheatsheet

Ruby on Rails 8: Testing

5 common Ruby on Rails 8 tasks.

Run all tests

Run every test except system tests.

bin/rails test

Run one test file

Run the tests in a single file.

bin/rails test test/models/article_test.rb

Run one test

Run the test that starts on line 12 of a file.

bin/rails test test/models/article_test.rb:12

Run system tests

Run browser-driven tests.

bin/rails test:system

Show code statistics

Count lines of code and tests.

bin/rails stats

Was this page helpful?