Last Updated: February 25, 2016·
Use a rake task to describe your Test::Unit tests
I've been considering switching to RSpec / BDD for my Rails projects, but after thinking about it I realized that all I really wanted was the nice output from the Spec command that described my code. I figured that there had to be a way to do this with my existing Test::Unit tests... so I wrote this quickly:
As it so happens, despite how rough it is, it actually does a pretty good job!
Just place the rake file in your lib/tasks/ folder and call it like this:
You can also call a specific class by passing it to rake as an argument:
The code is rough and definitely conforms to my way of writing tests, but I hope you can find it useful at least as a starting point for your projects.
Written by Jeremy Baker
HTTP Posts in Ruby
Have a fresh tip? Share with Coderwall community!
Post a tip
Best #Ruby Authors
Sponsored by #native_company# — Learn More