Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Web console activated in test environment warning showing despite not being in test group #293

Closed
alex-benoit opened this issue Jul 16, 2020 · 1 comment

Comments

@alex-benoit
Copy link

alex-benoit commented Jul 16, 2020

Web console complaining about being in the test environment but it is not. Warning shown after upgrade to 4.0.4

Warning seen:

Web Console is activated in the test environment. This is
usually a mistake. To ensure it's only activated in development
mode, move it to the development group of your Gemfile:

    gem 'web-console', group: :development

Gemfile:

group :development do
  gem 'web-console'

  gem 'listen'
  gem 'spring'
  gem 'spring-watcher-listen'
end

The error happens when running bundle exec rake but not rake by itself.

Rakefile:

require_relative 'config/application'

Rails.application.load_tasks

begin
  require 'rubocop/rake_task'
  RuboCop::RakeTask.new
rescue LoadError
  nil
end

task(:default).clear
task default: [
  'factory_bot:lint',
  'rubocop:auto_correct',
  'erblint:auto_correct',
  'stylelint:auto_correct',
  'eslint:auto_correct',
  :spec
]

bin/rake:

#!/usr/bin/env ruby
# frozen_string_literal: true

begin
  load File.expand_path('spring', __dir__)
rescue LoadError => e
  raise unless e.message.include?('spring')
end
require_relative '../config/boot'
require 'rake'
Rake.application.run

While does bundle exec prefix seems to affect the rails environment?

@alex-benoit
Copy link
Author

The solution involved prepending RAILS_ENV=test to the bundle exec command or adding ENV['RAILS_ENV'] ||= 'test' at the top of the Rakefile
bkeepers/dotenv#395 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant