cucumber / cucumber-ruby

Cucumber for Ruby. It's amazing!
https://cucumber.io
MIT License
5.18k stars 1.12k forks source link

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

Closed andyw8 closed 12 years ago

andyw8 commented 12 years ago

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).

Gemfile

source 'http://rubygems.org'

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'
end

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"
end

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

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"
end

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

env.rb

require 'cucumber/rails'

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

ActionController::Base.allow_rescue = false

begin
  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."
end
andyw8 commented 12 years ago

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

andyw8 commented 12 years ago

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

algogrit commented 12 years ago

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

This should solve the problem.

Victory10000 commented 12 years ago

Thank you. That solved it for me.

lock[bot] commented 5 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.