I'm going through a tutorial that has suggested using rspec
, but I have already gone through a lot of default rails installation. I really don't want to have to redo the installation at all. Anyway, when I run
$ rails g integration_test named
I get
invoke test_unit create test/integration/named_test.rb
When I run bundle
, various rspec
gems are listed, but test_unit
is not. The tutorial seems to have rails invoke rspec
instead of test_unit
without doing anything additional. How do I get rails to use rspec
with the integration test generator command?
In your config/application.rb
file :
config.generators do |g| g.test_framework :rspec end
Now when you run your generators (example rails generate scaffold post
), you get rspec test files. Remember to restart your server. For more information on generators see:
RailsCasts #216 Generators in Rails 3
If you really want to use the integration_test generator you'll need to specifically modify the command:
rails g integration_test named --integration-tool=rspec
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With