env.rb错误是什么意思,请参考?
root# rake db:migrate
WARNING: Cucumber-rails required outside of env.rb. The rest of loading is being defered until env.rb is called.
To avoid this warning, move 'gem cucumber-rails' under only group :test in your Gemfile
gemfile在这里:
source 'http://rubygems.org'
gem 'rails', '3.1.0'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
# for Heroku deployment - as described in Ap. A of ELLS book
group :development, :test do
gem 'sqlite3'
gem 'ruby-debug19', :require => 'ruby-debug'
gem 'cucumber-rails'
gem 'cucumber-rails-training-wheels'
gem 'database_cleaner'
gem 'capybara'
gem 'launchy'
end
group :production do
# gem 'pg'
end
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'therubyracer'
gem 'sass-rails', " ~> 3.1.0"
gem 'coffee-rails', "~> 3.1.0"
gem 'uglifier'
end
gem 'jquery-rails'
# Use unicorn as the web server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger
gem 'haml'
答案 0 :(得分:53)
这就是捆绑器的工作原理,您需要在:require => false
之后添加gem 'cucumber-rails'
。我不得不说错误信息有点误导。
答案 1 :(得分:4)
建议您在:test
组上隔离测试宝石。你的Gemfile看起来会像这样:
group :development, :test do
gem 'sqlite3'
gem 'ruby-debug19', :require => 'ruby-debug'
gem 'launchy'
end
group :test do
gem 'cucumber-rails'
gem 'cucumber-rails-training-wheels'
gem 'database_cleaner'
gem 'capybara'
end
就个人而言,我喜欢宝石的建议。我们真的不需要在我们的开发环境中加载测试宝石。