Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cucumber-rails required outside of env.rb. The rest of loading is being defered until env.rb is called

Tags:

What does this env.rb error mean, pls?

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 

The gemfile is here:

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' 
like image 465
Alpha01 Avatar asked Mar 20 '12 04:03

Alpha01


2 Answers

that's just how bundler works, you need to add :require => false after gem 'cucumber-rails'. I have to say the error message is a bit misleading.

like image 188
Bradley Priest Avatar answered Sep 19 '22 14:09

Bradley Priest


It is suggesting that you isolate your test gems on a :test group. Your Gemfile will then look somewhat like this:

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 

Personally, I liked the gem's suggestion. We really don't need the test gems loaded on our development environment.

like image 39
Fábio Batista Avatar answered Sep 21 '22 14:09

Fábio Batista