views:

82

answers:

4

I am new to rails, but not to ruby, and the book I am reading (Pragmatic Programmers Agile Dev. with Rails 4th Ed.) just introduced me to unit tests in Rails. The book showed me the default rails testing suite (a subclass of Test::Unit). In the Rails community, is this the main testing framework that is used, because I use RSpec when doing regular ruby, and I would like to be able to use it in Rails too (if it's not too much of a hassle)?

+1  A: 

Yes, rspec is used for Rails too. You can find some other examples listed here (although I didn't try most of them).

Nikita Rybak
+5  A: 

Rspec is widely used in rails, and in conjunction with Cucumber, is one of the most widely used solutions today. note that rails 3 is using rspec 2, so look for rspec/rails. check out the pragprog.com book rspec and cucumber, a great resource written by the core teams. http://pragprog.com/titles/achbd/the-rspec-book

Jed Schneider
+2  A: 

I would say rspec is the most widely used. It's easy to get it up and running, it's expressive and easy to use. Rails comes with Test::Unit support by default, but I don't see many people using it. And of course there's a myriad of smaller testing frameworks that a small number of people use. But it's mostly rspec.

AboutRuby
now that rails 3 is out it is important to note that rails provides test harness agnosticism, allowing you to pick your test solution and enforcing no baked in solution.
Jed Schneider