Thoughts about Rails testing and debugging
To those who don’t write unit testing code, you should seriously consider doing it. Good and well-covered unit tests prevents new changes break previous code and helps refactoring in the future.
In this article, i will bring up some tips and thoughts about unit testing in Ruby on Rails development. I hope you find some of them helpful.
Fail fast is very useful when i am doing TDD (Test Driven Development), or when i have a bunch of failed tests i need to fix one by one. Fail fast will abort once your test runner fails a test suite, instead of running all your test suites. It saves time and let you focus on one single problem.
Rails 5 has shipped fail fast feature for you, simply use
rails test -f or
rails test --fail-fast to enable fail fast option.
For previous versions of Rails application, you can try minitest-fail-fast gem. Notice that i have not checked if...
Continue reading →