RSpec Report in Text Format

I recently wanted to share RSpec examples with a business user. For some reason, it was kind of hard to find information on how to get a nice listing of all the examples present in your system. I believe Text and HTML formats are available, but I was unsure about how to pass spec command line options to the rake task.

This is how to get it done. On the command line from your Rails project's root:

  rake spec SPEC_OPTS="--format s -c"

This is a great way to validate a data model in plain English.

Not using RSpec? I highly recommend using it or a comparable framework to use business language as a definition for technical tests. Remember, if you follow Agile methodologies, you'll want to test before you implement any features.

Are you interested in learning more about Behavior Driven Development (BDD) and RSpec? Check out Peepcode's screencast.