ruby-on-rails-3rspecrspec2testunit

How can I tell Rails to use RSpec instead of test-unit when creating a new Rails app?


I have test-unit installed and rspec installed (along with -core, -expectations, -mocks and -rails version 2.6.x). When I run the command rails new foo, it uses test-unit to generate the test stub files instead of rspec.

Is there an option where I can tell rails to use rspec to generate the tests instead?


Solution

  • The following should work:

    at command line:

    rails new MYAPP -T # The -T option tells rails not to include Test::Unit
    

    in Gemfile:

    gem 'rspec-rails'
    

    at command line:

    bundle install
    rails g rspec:install