Search code examples
ruby-on-railsrubyruby-on-rails-3unit-testingrake-task

Why does a task named 'foo-test' throw an error in Rails?


A task defined as task :foo => :environment do runs fine, but the same task defined as task :foo-test => :environment do throws the error rake aborted! wrong number of arguments (0 for 2..3).

Why?


Solution

  • :foo-test is actually just :foo - test, you need to either name it :foo_test or :'foo-test'.