简体   繁体   中英

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?

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" 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM