Rspec-rails’s rake tasks not loaded in Rails engine

Having trouble getting the Rspec rake tasks to appear when you run “rake -T” in your Rails engine? The dummy app (which you should have if you specified –full) is not pulling in the Bundler dependencies, and as a result the rspec-rails Railtie subclass is not being created.

The fix, for me at least, is changing spec/dummy/config/application.rb line 11 or so to:

Bundler.require(*Rails.groups)

You should now have tasks such as “rake app:spec” available.

You may also need to update your root Rakefile to run the specs by default, by adding “task :default => ‘app:spec'”

Also see my issue on the railties Github

This was with Rails 3.2.8.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.