2011-07-07 23 views
0

我有一个与黄瓜1.0.0和黄瓜铁轨1.0.2轨应用程序。这些测试昨晚运行良好。今天我只是改变了一些步骤的定义,并试图运行测试,并得到下面的错误。我没有改变黄瓜支持文件中的任何内容。有任何想法吗?错误运行黄瓜测试 - 没有这样的文件加载

grouperty $ cucumber 
Using the default profile... 
no such file to load -- /Users/davidtuite/wd/grouperty/features/config/environment(LoadError) 
/Users/davidtuite/.rvm/rubies/ruby-1.9.2-head/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require' 
/Users/davidtuite/.rvm/rubies/ruby-1.9.2-head/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require' 
/Users/davidtuite/wd/grouperty/features/support/env.rb:12:in `block in <top (required)>' 
/Users/davidtuite/.rvm/gems/[email protected]/gems/spork-0.9.0.rc9/lib/spork.rb:24:in `prefork' 
/Users/davidtuite/wd/grouperty/features/support/env.rb:10:in `<top (required)>' 
/Users/davidtuite/.rvm/gems/[email protected]/gems/cucumber-1.0.0/lib/cucumber/rb_support/rb_language.rb:143:in `load' 
/Users/davidtuite/.rvm/gems/[email protected]/gems/cucumber-1.0.0/lib/cucumber/rb_support/rb_language.rb:143:in `load_code_file' 
/Users/davidtuite/.rvm/gems/[email protected]/gems/cucumber-1.0.0/lib/cucumber/runtime/support_code.rb:176:in `load_file' 
/Users/davidtuite/.rvm/gems/[email protected]/gems/cucumber-1.0.0/lib/cucumber/runtime/support_code.rb:78:in `block in load_files!' 
/Users/davidtuite/.rvm/gems/[email protected]/gems/cucumber-1.0.0/lib/cucumber/runtime/support_code.rb:77:in `each' 
/Users/davidtuite/.rvm/gems/[email protected]/gems/cucumber-1.0.0/lib/cucumber/runtime/support_code.rb:77:in `load_files!' 
/Users/davidtuite/.rvm/gems/[email protected]/gems/cucumber-1.0.0/lib/cucumber/runtime.rb:137:in `load_step_definitions' 
/Users/davidtuite/.rvm/gems/[email protected]/gems/cucumber-1.0.0/lib/cucumber/runtime.rb:39:in `run!' 
/Users/davidtuite/.rvm/gems/[email protected]/gems/cucumber-1.0.0/lib/cucumber/cli/main.rb:43:in `execute!' 
/Users/davidtuite/.rvm/gems/[email protected]/gems/cucumber-1.0.0/lib/cucumber/cli/main.rb:20:in `execute' 
/Users/davidtuite/.rvm/gems/[email protected]/gems/cucumber-1.0.0/bin/cucumber:14:in `<top (required)>' 
/Users/davidtuite/.rvm/gems/[email protected]/bin/cucumber:19:in `load' 

/Users/davidtuite/.rvm/gems/[email protected]/bin/cucumber:19:in`”

这里是/features/support/env.rb内容。请注意,它大部分是由spork gem(v0.9.0.rc9)生成的。

# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril. 
# It is recommended to regenerate this file in the future when you upgrade to a 
# newer version of cucumber-rails. Consider adding your own code to a new file 
# instead of editing this one. Cucumber will automatically load all features/**/*.rb 
# files. 

require 'rubygems' 
require 'spork' 

Spork.prefork do 
    ENV["RAILS_ENV"] ||= 'test' 
    require File.expand_path("../../config/environment", __FILE__) 
    require 'cucumber/rails' 

    # Capybara defaults to XPath selectors rather than Webrat's default of CSS3. In 
    # order to ease the transition to Capybara we set the default here. If you'd 
    # prefer to use XPath just remove this line and adjust any selectors in your 
    # steps to use the XPath syntax. 
    Capybara.default_selector = :css 

end 

Spork.each_run do 
    # By default, any exception happening in your Rails application will bubble up 
    # to Cucumber so that your scenario will fail. This is a different from how 
    # your application behaves in the production environment, where an error page will 
    # be rendered instead. 
    # 
    # Sometimes we want to override this default behaviour and allow Rails to rescue 
    # exceptions and display an error page (just like when the app is running in production). 
    # Typical scenarios where you want to do this is when you test your error pages. 
    # There are two ways to allow Rails to rescue exceptions: 
    # 
    # 1) Tag your scenario (or feature) with @allow-rescue 
    # 
    # 2) Set the value below to true. Beware that doing this globally is not 
    # recommended as it will mask a lot of errors for you! 
    # 
    ActionController::Base.allow_rescue = false 

    # Remove/comment out the lines below if your app doesn't have a database. 
    # For some databases (like MongoDB and CouchDB) you may need to use :truncation instead. 
    begin 
    DatabaseCleaner.strategy = :transaction 
    rescue NameError 
    raise "You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it." 
    end 

    # You may also want to configure DatabaseCleaner to use different strategies for certain features and scenarios. 
    # See the DatabaseCleaner documentation for details. Example: 
    # 
    # Before('@no-txn,@selenium,@culerity,@celerity,@javascript') do 
    #  DatabaseCleaner.strategy = :truncation, {:except => %w[widgets]} 
    # end 
    # 
    # Before('[email protected]', '[email protected]', '[email protected]', '[email protected]', '[email protected]') do 
    #  DatabaseCleaner.strategy = :transaction 
    # end 
    # 
end 
+0

请张贴'/用户/ davidtuite/WD/grouperty /特征/支持/ env.rb'代码 – Bohdan

+0

我追加了'env.rb' –

回答

4

此线

require File.expand_path("../../config/environment", __FILE__) 

要求

/Users/davidtuite/wd/grouperty/features/config/environment 

其不存在有这会导致错误

+0

很明显,一旦你说出来!谢谢。 –