"The web console is activated in a test environment" when testing the application

I am new to Rails. So apologize in advance if this is a stupid question. I went through Michael Hartle's book and tried to code the application myself.

I wrote some basic tests, but when trying to test the application with

$ bundle exec rake test

I get the following message on terminal

Web Console is activated in the test environment, which is
usually a mistake. To ensure it 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
configuration:

    config.web_console.development_only = false

When I add above to development.rb, it still doesn't matter.

Please help me understand what I'm doing wrong.

+4
source share
4 answers

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

Gemfile? , , .

Gemfile :

gem 'web-console', group: :development

group :development do
  gem 'web-console'
end
+9

Gem,

gem 'web-console', '~> 2.0'

.

$ gem install bundler

$ bundle install --without production
+1

ROR Michael Heartl ! , , - "" Gemfile. , Gemfile :

group :development do

  gem 'sqlite3'

  gem 'byebug'

  gem 'spring'

  gem 'web-console', '~> 2.0'

end


group :test do

  gem 'minitest-reporters'

  gem 'mini_backtrace'

  gem 'guard'

  gem 'guard-minitest'

end

:

bundle install --without production

:

bundle exec rake test
0

I took Michael Hartl's course. I know that the Gemfile claims that you should have it as it is, but it calls this message. If you do not want to modify the Gemfile and leave it as a way in the book, you can go to config> environment> test.rb and add the line below.

config.web_console.development_only = false

Save it and you are good to go.

0
source

Source: https://habr.com/ru/post/1629020/


All Articles