2010-10-06 171 views
1

爲什麼當我運行任務:運行rake任務

my_project> rake import:twitter 

Task.path:LIB /任務/ 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 

如何在不運行測試,在執行任務的時候?

+0

你的Rakefile和rask文件任務如何? – shingara 2010-10-06 06:16:36

回答

0

你好你可以寫你的任務一個接着寫新一個會調用兩個不同的任務 - 運行測試和你有點像task :run_all => ['db:test:clone ', 'db:test:prepare ', 'test:units', :your_task]

0

有沒有執行的測試(你所要的計數爲0)。

如果您加載test/unit,您將獲得測試統計信息。剛剛嘗試與文件:

require 'test/unit' 

你可以檢查你的Rakefile,如果您加載任何地方test/unit? (也許是在需要的文件之一)您可以檢查$"它是否包含test/unit

背景: 測試單元開始at_exit(腳本結束)的一些程序和查找內部測試的兒童的測試方法::股:: TestCase並執行它們。在此之後,統計信息被寫入。沒有測試,你會得到'空'測試統計。