【问题标题】:web-console warning is preventing me from testing my rails app网络控制台警告阻止我测试我的 Rails 应用程序
【发布时间】:2016-04-15 22:56:47
【问题描述】:

当我在我的 rails 应用程序中运行 bundle exec rake test 时,我收到以下消息

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

但是我的 Gemfile 在测试和开发环境中都有 web 控制台

group :development, :test do
  gem 'sqlite3'
  gem 'byebug'
  gem 'web-console'
  gem 'spring'
end

这正是我在我的 Cloud9 帐户上使用它的方式,它运行良好,但我在运行 Ubuntu 14.04 的笔记本电脑上遇到了这个问题。怎么回事?

【问题讨论】:

    标签: ruby-on-rails ubuntu-14.04 gemfile web-console


    【解决方案1】:

    这可能是一个专门关于 Cloud9 的问题,我没有使用过。要解决您的问题,请将 'web-console' 行移到组外,然后更改为

    gem 'web-console', group: :development
    

    基本上将web-console:test 组中取出。另外,试试rake test。你可能也忘记了bundle update

    【讨论】:

    • 如果我这样做并运行rake test,我会得到错误输出Running via Spring preloader in process 5329 /usr/local/lib/ruby/gems/2.2.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in require': cannot load such file --guard (LoadError)`(后面有更多垃圾)
    • 你能把你的整个Gemfile贴出来吗?你在用guard吗?你能把guard 移到:development 组吗?它不需要在:test
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多