Lanka_ruby Lanka_ruby - 1 year ago 463
Ruby Question

"Web console is activated in the test environment" when testing app

I'm a newbie to Rails. Therefore, apologies in advance if this is a dumb question. I have gone through Michael Heartl's book and tried coding an app myself.

I have written a few basic tests, but when trying to test the app with

$bundle exec rake test

I get the following message on the terminal

Web Console is activated in the test environment, which 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

If you still want to run it the test environment (and know
what you are doing), put this in your Rails application

config.web_console.development_only = false

When I add the above to development.rb it still doesn't make a difference.

Please help me understand what I'm doing wrong.

Answer Source

What you need to do is make sure that in your Gemfile the line gem 'web-console' is only loaded in the group development.

Can you maybe post your Gemfile? This way we can see if that is what's causing it.

In your Gemfile it should either be:

gem 'web-console', group: :development


group :development do gem 'web-console' end