Tools
RSpec combines several tools in one package
1) A language for expressing behavior
RSpec provides programmers with a domain specific language for defining expected behavior of Ruby code.
2) A runner for verifying behavior
RSpec provides a command line utility for executing behavior specifications.
3) Mock objects
Mock objects frameworks usually come as separate add-ons to existing XUnit frameworks. In RSpec it’s an integrated
part of the framework.
4) Testdox-like reports
Expressing behavior in real sentences improves communication between programmer,
analysts and testers. It also helps programmers keep a more critical mind about the code being developed.
RSpec’s built in support for generating testdox-like reports makes the code’s behavior more transparent
to everybody (assuming you publish it to a webpage where everybody who needs to can see it).
5) RCov Coverage tool integration
While coverage tools cannot prove that you have verified everything there is to verify about your code,
they can prove when you have not verified everything there is to verify about your code. RCov is such a
coverage tool, and RSpec supports it out-of the box via its Rake task.
6) Coverage threshold verification
Except for the times when programmers agree to keep a close eye on coverage and keep it at, say 90%, it
will inevitably drop when they get other things to think about and start to write code in the wild.
RSpec ships with a special Rake task that can verify that the coverage remains on a level defined by the
development team. Should the coverage drop, the build will fail, and developers are encouraged to address
it right away.
7) Integrated diffing
When you run specs with the —diff option, you’ll see unified diffs when Strings don’t match.
Very useful when your specs are comparing big strings!
8) Mutation with Heckle
The —heckle option will run your specs with mutations.