2012-05-03 37 views
5

Tôi vừa nâng cấp lên ruby ​​1.9.3-p125 (từ 1.9.3-p0). Tất cả các thử nghiệm đều hoạt động trước khi nâng cấp. Bây giờ tôi nhận được lỗi sau khi chạy cào tính năngRails dưa chuột undefined phương pháp `config 'cho nil: NilClass (NoMethodError)

Using the default profile... 
undefined method `config' for nil:NilClass (NoMethodError) 
/home/map7/.rvm/gems/[email protected]/gems/cucumber-rails-1.3.0/lib/cucumber/rails.rb:17:in `<top (required)>' 
/home/map7/.rvm/gems/[email protected]/gems/bundler-1.1.3/lib/bundler/runtime.rb:74:in `require' 
/home/map7/.rvm/gems/[email protected]/gems/bundler-1.1.3/lib/bundler/runtime.rb:74:in `rescue in block in require' 
/home/map7/.rvm/gems/[email protected]/gems/bundler-1.1.3/lib/bundler/runtime.rb:62:in `block in require' 
/home/map7/.rvm/gems/[email protected]/gems/bundler-1.1.3/lib/bundler/runtime.rb:55:in `each' 
/home/map7/.rvm/gems/[email protected]/gems/bundler-1.1.3/lib/bundler/runtime.rb:55:in `require' 
/home/map7/.rvm/gems/[email protected]/gems/bundler-1.1.3/lib/bundler.rb:119:in `require' 
/home/map7/pais/config/application.rb:7:in `<top (required)>' 
/home/map7/pais/config/environment.rb:2:in `require' 
/home/map7/pais/config/environment.rb:2:in `<top (required)>' 
/home/map7/pais/features/support/env.rb:8:in `require' 
/home/map7/pais/features/support/env.rb:8:in `<top (required)>' 
/home/map7/.rvm/gems/[email protected]/gems/cucumber-1.1.9/lib/cucumber/rb_support/rb_language.rb:129:in `load' 
/home/map7/.rvm/gems/[email protected]/gems/cucumber-1.1.9/lib/cucumber/rb_support/rb_language.rb:129:in `load_code_file' 
/home/map7/.rvm/gems/[email protected]/gems/cucumber-1.1.9/lib/cucumber/runtime/support_code.rb:171:in `load_file' 
/home/map7/.rvm/gems/[email protected]/gems/cucumber-1.1.9/lib/cucumber/runtime/support_code.rb:83:in `block in load_files!' 
/home/map7/.rvm/gems/[email protected]/gems/cucumber-1.1.9/lib/cucumber/runtime/support_code.rb:82:in `each' 
/home/map7/.rvm/gems/[email protected]/gems/cucumber-1.1.9/lib/cucumber/runtime/support_code.rb:82:in `load_files!' 
/home/map7/.rvm/gems/[email protected]/gems/cucumber-1.1.9/lib/cucumber/runtime.rb:175:in `load_step_definitions' 
/home/map7/.rvm/gems/[email protected]/gems/cucumber-1.1.9/lib/cucumber/runtime.rb:40:in `run!' 
/home/map7/.rvm/gems/[email protected]/gems/cucumber-1.1.9/lib/cucumber/cli/main.rb:43:in `execute!' 
/home/map7/.rvm/gems/[email protected]/gems/cucumber-1.1.9/lib/cucumber/cli/main.rb:20:in `execute' 
/home/map7/.rvm/gems/[email protected]/gems/cucumber-1.1.9/bin/cucumber:14:in `<top (required)>' 
/home/map7/.rvm/gems/[email protected]/bin/cucumber:19:in `load' 
/home/map7/.rvm/gems/[email protected]/bin/cucumber:19:in `<main>' 
rake aborted! 
Command failed with status (1): [/home/map7/.rvm/rubies/ruby-1.9.3-p194/bin...] 

Tasks: TOP => features => cucumber => cucumber:ok 
(See full trace by running task with --trace) 

tôi ngược trở lại này vào dòng tập tin rails.rb 17 như đã đề cập trong các lỗi:

if !Rails.application.config.cache_classes 
    warn "WARNING: You have set Rails' config.cache_classes to false (most likely in config/environments/cucumber.rb). This setting is known to cause problems with database transactions. Set config.cache_classes to true if you want to use transactions. For more information see https://rspec.lighthouseapp.com/projects/16211/tickets/165." 
    end 

Vì vậy, nó có vẻ như nó không thể tìm thấy Rails .application khi trong dưa chuột.

Nếu tôi đi vào bàn điều khiển 'ray c' và gõ Rails.application.config nó sẽ trả về đối tượng Cấu hình.

Tôi đã thử nâng cấp đá quý dưa chuột lên 1.3.0 và dưa chuột 1.1.9.

+1

Bạn đã thử làm [this] (https://github.com/cucumber/cucumber-rails/issues/187 # issuecomment-4160160)? – pjumble

+0

Cảm ơn đã sửa lỗi. – map7

Trả lời

6

Đây có thể là sự cố tải đơn đặt hàng với đá quý dưa chuột. Nếu bạn cập nhật Gemfile của bạn không tải nó ngay lập tức nó sẽ được yêu cầu sau này trong quá trình:

gem "cucumber-rails", "1.3.0", :require => false 
Các vấn đề liên quan