Test tasks missing from rake: rake aborted! Don't know how to build task 'test:units'

5.9k views Asked by At

I created a Rails 4 app recently and for some reason my rake tasks don't include test. Here's some console action to demonstrate the problem:

> rake test:units
    rake aborted!
    Don't know how to build task 'test:units'
    /Users/clozach/.rvm/gems/ruby-2.1.3@hoverfly/bin/ruby_executable_hooks:15:in `eval'
    /Users/clozach/.rvm/gems/ruby-2.1.3@hoverfly/bin/ruby_executable_hooks:15:in `<main>'
    (See full trace by running task with --trace)

Fail. :(

> rake test
>

No output. :(

> rake -T --all | grep test
    rake db:test:clone                      # 
    rake db:test:clone_schema               # 
    rake db:test:clone_structure            # 
    rake db:test:deprecated                 # 
    rake db:test:load                       # 
    rake db:test:load_schema                # 
    rake db:test:load_structure             # 
    rake db:test:prepare                    # 
    rake db:test:purge                      # 
    rake log:clear                          # Truncates all *.log files in log/ to zero bytes (specify which logs with LOGS=test,development)
    rake tmp/cache/assets/test              # 

No test tasks at all! :'(

Any idea why this is the case, and what I can do to fix it?

1

There are 1 answers

1
Jiří Pospíšil On BEST ANSWER

Take a look into config/application.rb whether the testing framework is actually required there. At the very top, there should be

require "rails/all"

Depending on your setup, you might have each individual component required separately. Make sure that test_unit is among them.

require "rails/test_unit/railtie"