我最近创建了一个Rails 4应用程序,出于某种原因,我的rake任务不包括test
。这里有一些控制台动作来演示问题:
> 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)
失败。 :(
> rake test
>
没有输出。 :(
> 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 #
完全没有test
个任务! :&#39;(
知道为什么会这样,我能做些什么来解决它?
答案 0 :(得分:10)
查看config/application.rb
是否确实需要测试框架。在最顶层,应该有
require "rails/all"
根据您的设置,您可能需要单独使用每个单独的组件。确保test_unit
就在其中。
require "rails/test_unit/railtie"