我正在运行Rails 3.2.1并通过railstutorial.org第6章在测试环境中运行。输入“rails console test”后,将生成以下命令:
/Users/fanattix/rails_projects/sample_app/app/assets/stylesheets/joshuaclayton-blueprint-css-9bf9513/features/step_definitions/blueprint_steps.rb:1:in `<top (required)>': undefined method `When' for main:Object (NoMethodError)
from /Users/fanattix/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:251:in `require'
from /Users/fanattix/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:251:in `block in require'
from /Users/fanattix/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:236:in `load_dependency'
from /Users/fanattix/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:251:in `require'
from /Users/fanattix/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:359:in `require_or_load'
from /Users/fanattix/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:313:in `depend_on'
from /Users/fanattix/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:225:in `require_dependency'
from /Users/fanattix/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/engine.rb:439:in `block (2 levels) in eager_load!'
from /Users/fanattix/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/engine.rb:438:in `each'
from /Users/fanattix/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/engine.rb:438:in `block in eager_load!'
from /Users/fanattix/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/engine.rb:436:in `each'
from /Users/fanattix/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/engine.rb:436:in `eager_load!'
from /Users/fanattix/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/application/finisher.rb:53:in `block in <module:Finisher>'
from /Users/fanattix/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/initializable.rb:30:in `instance_exec'
from /Users/fanattix/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/initializable.rb:30:in `run'
from /Users/fanattix/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/initializable.rb:55:in `block in run_initializers'
from /Users/fanattix/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/initializable.rb:54:in `each'
from /Users/fanattix/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/initializable.rb:54:in `run_initializers'
from /Users/fanattix/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/application.rb:136:in `initialize!'
from /Users/fanattix/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /Users/fanattix/rails_projects/sample_app/config/environment.rb:5:in `<top (required)>'
from /Users/fanattix/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/application.rb:103:in `require'
from /Users/fanattix/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/application.rb:103:in `require_environment!'
from /Users/fanattix/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/commands.rb:40:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
我一直在“开发”环境中运行得很好。当我试图在测试和生产中运行时出现问题。
答案 0 :(得分:0)
Gemfile
组中:development
组:test
中的{{1}}似乎有宝石。