2010-11-07 62 views
3

每次我運行Rspec2和Rails3的rake規格時,都會使用rake中止完成。想知道這是否是正常行爲,或者如果我一路上犯了一些錯誤?應該在Rspec 3中的rake規格總是以「rake aborted」結束


........ 
Finished in 0.01589 seconds 
7 examples, 6 failures, 1 pending 


rake aborted! 
ruby -S bundle exec rspec "./spec/helpers/homes_helper_spec.rb" "./spec/models/habit_spec.rb" failed 
/Users/jack/.rvm/gems/ruby-1.8.7-p174/gems/rspec-core-2.0.1/lib/rspec/core/rake_task.rb:117:in `initialize' 
/Users/jack/.rvm/gems/ruby-1.8.7-p174/gems/rake-0.8.7/lib/rake.rb:1112:in `verbose' 
/Users/jack/.rvm/gems/ruby-1.8.7-p174/gems/rspec-core-2.0.1/lib/rspec/core/rake_task.rb:109:in `send' 
/Users/jack/.rvm/gems/ruby-1.8.7-p174/gems/rspec-core-2.0.1/lib/rspec/core/rake_task.rb:109:in `initialize' 
/Users/jack/.rvm/gems/ruby-1.8.7-p174/gems/rake-0.8.7/lib/rake.rb:636:in `call' 
/Users/jack/.rvm/gems/ruby-1.8.7-p174/gems/rake-0.8.7/lib/rake.rb:636:in `execute' 
/Users/jack/.rvm/gems/ruby-1.8.7-p174/gems/rake-0.8.7/lib/rake.rb:631:in `each' 
/Users/jack/.rvm/gems/ruby-1.8.7-p174/gems/rake-0.8.7/lib/rake.rb:631:in `execute' 
/Users/jack/.rvm/gems/ruby-1.8.7-p174/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain' 
/Users/jack/.rvm/rubies/ruby-1.8.7-p174/lib/ruby/1.8/monitor.rb:242:in `synchronize' 
/Users/jack/.rvm/gems/ruby-1.8.7-p174/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain' 
/Users/jack/.rvm/gems/ruby-1.8.7-p174/gems/rake-0.8.7/lib/rake.rb:583:in `invoke' 
/Users/jack/.rvm/gems/ruby-1.8.7-p174/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task' 
/Users/jack/.rvm/gems/ruby-1.8.7-p174/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level' 
/Users/jack/.rvm/gems/ruby-1.8.7-p174/gems/rake-0.8.7/lib/rake.rb:2029:in `each' 
/Users/jack/.rvm/gems/ruby-1.8.7-p174/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level' 
/Users/jack/.rvm/gems/ruby-1.8.7-p174/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling' 
/Users/jack/.rvm/gems/ruby-1.8.7-p174/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level' 
/Users/jack/.rvm/gems/ruby-1.8.7-p174/gems/rake-0.8.7/lib/rake.rb:2001:in `run' 
/Users/jack/.rvm/gems/ruby-1.8.7-p174/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling' 
/Users/jack/.rvm/gems/ruby-1.8.7-p174/gems/rake-0.8.7/lib/rake.rb:1998:in `run' 
/Users/jack/.rvm/gems/ruby-1.8.7-p174/gems/rake-0.8.7/bin/rake:31 
/Users/jack/.rvm/gems/ruby-1.8.7-p174/bin/rake:19:in `load' 
/Users/jack/.rvm/gems/ruby-1.8.7-p174/bin/rake:19 

回答

2

此刻,做rspec spec/不會產生巨大的「耙子中止!」堆棧跟蹤,但默認情況下,您的Rakefile任務將會。爲了抑制這種情況,可以嘗試在Rakefile中粘貼這樣的內容。

# This clears the default spec task from MyApp::Application.load_tasks 
Rake::Task["spec"].clear 

# This defines your new spec task with a suppressed stack trace 
RSpec::Core::RakeTask.new(:spec) do |t| 
    t.fail_on_error = false 
end 
相關問題