2011-10-25 48 views

回答

2

回答我自己的問題。如果有人感興趣,我可以發佈更詳細的答案。

它正在評估測試文件,然後從評估測試獲取上下文的要點是:

Riot.alone! # so Riot doesn't automatically run the tests 

["/path/to/test/file"].each do |test_file| 
    eval(IO.read(path), binding, test_file) # load test file 

    Riot.root_contexts.each do |context| 
    reporter = MyReporter.new 
    context.run reporter 
    # do something cool with reporter results 
    end 

    Riot.root_contexts.clear # clean out root_contexts so it's clean for the next run 
end 

哪裏MyReporter是你實現的用於通過/失敗測試結果。見https://github.com/thumblemonks/riot/blob/master/lib/riot/reporter.rb