“在测试环境中激活 Web 控制台"测试应用程序时 [英] "Web console is activated in the test environment" when testing app

查看:37
本文介绍了“在测试环境中激活 Web 控制台"测试应用程序时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 Rails 的新手.因此,如果这是一个愚蠢的问题,请提前道歉.我已经阅读了 Michael Heartl 的书并尝试自己编写应用程序.

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 测试

$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
configuration:

    config.web_console.development_only = false

当我将上述内容添加到 development.rb 时,它仍然没有任何区别.

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

请帮助我理解我做错了什么.

Please help me understand what I'm doing wrong.

推荐答案

你需要做的是确保在你的 Gemfile 中的行 gem 'web-console' 只加载到组中发展.

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

您可以发布您的 Gemfile 吗?通过这种方式,我们可以查看是否是造成这种情况的原因.

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

在您的 Gemfile 中,它应该是:

In your Gemfile it should either be:

gem 'web-console', group: :development

group :development do
  gem 'web-console'
end

这篇关于“在测试环境中激活 Web 控制台"测试应用程序时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆