Skip to content
This repository

Warning for Cucumber-rails required outside of env.rb #249

andyw8 opened this Issue · 4 comments

3 participants

Andy Waite Gaurav Agarwal Victory10000
Andy Waite

When running my tests I'm getting the warning:

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

but my Gemfile already has that structure (it comes from the Suspenders gem by Thoughtbot).


source ''

gem 'rails', '3.1.1'

gem 'pg'

group :assets do
  gem 'sass-rails',   '~> 3.1.4'
  gem 'coffee-rails', '~> 3.1.1'
  gem 'uglifier', '>= 1.0.3'

gem 'jquery-rails'
gem 'clearance'
gem 'thin'
gem 'sass'
gem 'high_voltage'
gem 'paperclip'
gem 'formtastic'
gem 'flutie'
gem 'bourbon'
gem 'copycopter_client'
gem 'airbrake'

group :development do
  gem "heroku"

group :development, :test do
  gem "rspec-rails", "~> 2.6.1"
  gem "ruby-debug19"
  gem "sham_rack"

group :test do
  gem "cucumber-rails", "1.1.0"
  gem "capybara-webkit", "~> 0.7.1"
  gem "factory_girl_rails"
  gem "bourne"
  gem "database_cleaner"
  gem "timecop"
  gem "shoulda-matchers"
  gem "launchy"
  gem "email_spec"

group :staging, :production do
  gem 'sprockets-redirect'


require 'cucumber/rails'

Capybara.save_and_open_page_path = 'tmp'
Capybara.javascript_driver = :webkit
Capybara.default_selector = :css

ActionController::Base.allow_rescue = false

  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."
Andy Waite

Also, I still get the warning if I remove require 'cucumber/rails' from env.rb

Andy Waite

Sorry, meant to post this in cucumber-rails. Will move it over.

Andy Waite andyw8 closed this
Gaurav Agarwal

gem "cucumber-rails", "1.1.0", require: false

This should solve the problem.


Thank you. That solved it for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.