运行 rake 任务
为什么当我运行任务:
my_project> rake import:twitter
Task.path: lib/task/import_twitter.rake
namespace :import do
task :twitter => :environment do
puts "importing...."
end
end
然后测试也运行?
在控制台输出中:
importing....
Loaded suite C:/Ruby/bin/rake
Started
Finished in 0.001 seconds.
0 tests, 0 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifica
tions
0% passed
执行任务时如何不运行测试?
Why when i run task :
my_project> rake import:twitter
Task.path: lib/task/import_twitter.rake
namespace :import do
task :twitter => :environment do
puts "importing...."
end
end
then tests also run?
In the console output:
importing....
Loaded suite C:/Ruby/bin/rake
Started
Finished in 0.001 seconds.
0 tests, 0 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifica
tions
0% passed
How not to run the tests, when the task is executed?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您好,您可以编写您的任务,然后编写新的任务,该任务将调用两个单独的任务 - 运行测试和您的任务,例如
task :run_all => ['db:test:clone', 'db:test:prepare', 'test:units', :your_task]
Hi You may write your task an then write new one that'll invoke two separate tasks - run tests and yours something like
task :run_all => ['db:test:clone ', 'db:test:prepare ', 'test:units', :your_task]
没有执行任何测试(计数始终为 0)。
如果加载
test/unit
,您始终会获得测试统计数据。只需尝试一个文件:如果您加载到任何地方
test/unit
,您可以检查您的rakefile吗? (也许它在必需的文件之一中)您可以检查$"
是否包含test/unit
背景:
test-unit 启动
at_exit
(脚本结束)一些例程,并在 Test::Unit::TestCase 的子级中查找测试方法并执行它们。之后,写入统计数据。如果没有测试,您将得到“空”测试统计数据。There are no tests executed (you have always the count 0).
You get the test statistic always if you load
test/unit
. Just try a file with:Can you check your rakefile, if you load anywhere
test/unit
? (maybe it is in one of the required files) You may check$"
if it containstest/unit
Background:
test-unit starts
at_exit
(script end) some routines and looks for test-methods inside children of Test::Unit::TestCase and executes them. After this, the statistic is written. Without tests, you get the 'empty' test statistic.