2011-03-28 49 views
1

我試圖用RSpec設置自動測試。之前從未有過的問題,但是當我運行rspec --configure autotest,我收到以下錯誤/跟蹤:`rspec --configure autotest`引發「未初始化的常量Class :: FileUtils」

Autotest loads RSpec's Autotest subclass when there is a .rspec file in the project's root directory. 
/Users/brennon/.rvm/gems/[email protected]/gems/rspec-core-2.5.1/lib/rspec/core/backward_compatibility.rb:20:in `const_missing': uninitialized constant Class::FileUtils (NameError) 
    from /Users/brennon/.rvm/gems/[email protected]/gems/rspec-core-2.5.1/lib/rspec/core/command_line_configuration.rb:38:in `create_dot_rspec_file' 
    from /Users/brennon/.rvm/gems/[email protected]/gems/rspec-core-2.5.1/lib/rspec/core/command_line_configuration.rb:29:in `generate' 
    from /Users/brennon/.rvm/gems/[email protected]/gems/rspec-core-2.5.1/lib/rspec/core/command_line_configuration.rb:12:in `run' 
    from /Users/brennon/.rvm/gems/[email protected]/gems/rspec-core-2.5.1/lib/rspec/core/option_parser.rb:101:in `block (2 levels) in parser' 
    from /Users/brennon/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/optparse.rb:1277:in `call' 
    from /Users/brennon/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/optparse.rb:1277:in `block in parse_in_order' 
    from /Users/brennon/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/optparse.rb:1264:in `catch' 
    from /Users/brennon/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/optparse.rb:1264:in `parse_in_order' 
    from /Users/brennon/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/optparse.rb:1258:in `order!' 
    from /Users/brennon/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/optparse.rb:1349:in `permute!' 
    from /Users/brennon/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/optparse.rb:1370:in `parse!' 
    from /Users/brennon/.rvm/gems/[email protected]/gems/rspec-core-2.5.1/lib/rspec/core/option_parser.rb:18:in `parse!' 
    from /Users/brennon/.rvm/gems/[email protected]/gems/rspec-core-2.5.1/lib/rspec/core/option_parser.rb:4:in `parse!' 
    from /Users/brennon/.rvm/gems/[email protected]/gems/rspec-core-2.5.1/lib/rspec/core/configuration_options.rb:88:in `command_line_options' 
    from /Users/brennon/.rvm/gems/[email protected]/gems/rspec-core-2.5.1/lib/rspec/core/configuration_options.rb:122:in `custom_options_file' 
    from /Users/brennon/.rvm/gems/[email protected]/gems/rspec-core-2.5.1/lib/rspec/core/configuration_options.rb:65:in `parse_options' 
    from /Users/brennon/.rvm/gems/[email protected]/gems/rspec-core-2.5.1/lib/rspec/core/runner.rb:41:in `run' 
    from /Users/brennon/.rvm/gems/[email protected]/gems/rspec-core-2.5.1/lib/rspec/core/runner.rb:10:in `block in autorun' 

只需運行rspec運行良好,運行autotest運行正常爲好,但只加載黃瓜功能。另外,require 'fileutils'在irb中返回true。有任何想法嗎?

回答

-1

我不知道爲什麼,看起來這不可能是正確的解決方案,但刪除並重新創建.rspec文件解決了問題。

相關問題