Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


running "rails new foo --skip-test-unit" does not remote :test task from rake :default prerequisites #2564

bartocc opened this Issue · 14 comments

9 participants


with 3.1.0.rc.6

rails new foo --skip-test-unit
cd foo
bundle exec rake

=> Don't know how to build task 'test'

If I add this at the end of the Rakefile

raise Rake::Task[:default].inspect
=> [test]>

shouldn't the :test task be removed from the :default prerequisites ?


I came across the same thing and I thought this was a bug in rspec-rails (rspec/rspec-rails#438).


Does anyone have a good workaround?


@tsaleh, you can do this in your Rakefile

task :default => [:spec]

I'll see if I can submit a pull request to solve this issue


Ah, clearing the prereq's did the trick! Thanks!

task :test => :spec

This is all because railties/lib/tasks/misc.rake sets the default task to :test regardless of whether test unit is loaded or not.


@raggi - nevermind, apparently I'm not actually reading.


You can work around this by uncommenting the test_unit railtie in application.rb.

# Pick the frameworks you want:
# ...other railties
require "rails/test_unit/railtie"

@hecticjeff - then why have --skip-test-unit option in the first place?


@mguterl Like I said, it's a workaround. This wasn't necessary before rails 3.1, so I think it must be a regression somewhere.

@josevalim josevalim closed this in 8a4239f

I have the same issue, I added this to my Rakefile:

task :test => [:spec]
task :default => [:spec]

But I'm still getting this:

# rake
rake aborted!
Don't know how to build task 'test'

(See full trace by running task with --trace)

Any ideas?


I still have same problem, did try all the solution above.
I can't invoke any rakes in Rspec tests.
gem 'rails', '3.2.6'
gem 'rspec', "~> 2.9.0"
gem 'rspec-rails', "~> 2.9.0"


Make sure you

  1. have rspec-rails declared in the :development, :test group in your Gemfile
  2. don't have require: false set on rspec-rails
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.