Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 230
clozach Avatar asked Nov 11 '14 20:11

clozach


1 Answers

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" 
like image 176
Jiří Pospíšil Avatar answered Sep 28 '22 10:09

Jiří Pospíšil