首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用"spring rspec“而非"rspec”的弃用警告

使用"spring rspec“而非"rspec”的弃用警告
EN

Stack Overflow用户
提问于 2016-09-09 15:58:13
回答 1查看 361关注 0票数 1

当我通过邦德勒运行规范时,我没有错误.

代码语言:javascript
复制
bundle exec rspec -fd spec/controllers/blah.rb

但是,当我通过binstub运行它来使用spring时,我得到了很多这样的错误:

代码语言:javascript
复制
./bin/rspec -fd spec/controllers/blah.rb

DEPRECATION WARNING: `serialized_attributes` is deprecated without replacement, and will be removed in Rails 5.0.

为什么会这样呢?

我试着停止和开始;没有效果。

config/environments/test.rb中,我有以下内容:

代码语言:javascript
复制
# Print deprecation notices to the stderr.
config.active_support.deprecation = :stderr

供参考..。

代码语言:javascript
复制
$ bundle list | grep -E '(rspec|spring)'
  * rspec-core (3.0.4)
  * rspec-expectations (3.0.4)
  * rspec-mocks (3.0.4)
  * rspec-rails (3.0.2)
  * rspec-support (3.0.4)
  * spring (1.7.2)
  * spring-commands-rspec (1.0.4)

按照要求,我的./bin/rspec文件.

代码语言:javascript
复制
$ cat ./bin/rspec
#!/usr/bin/env ruby
begin
  load File.expand_path('../spring', __FILE__)
rescue LoadError => e
  raise unless e.message.include?('spring')
end
# frozen_string_literal: true
#
# This file was generated by Bundler.
#
# The application 'rspec' is installed as part of a gem, and
# this file is here to facilitate running it.
#

require "pathname"
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
  Pathname.new(__FILE__).realpath)

require "rubygems"
require "bundler/setup"

load Gem.bin_path("rspec-core", "rspec")
EN

回答 1

Stack Overflow用户

发布于 2016-09-09 16:32:21

一个可能的解决办法是改变这一点:

代码语言:javascript
复制
config.active_support.deprecation = :stderr

代码语言:javascript
复制
config.active_support.deprecation = :silence

然而,这并不能解释为什么它压制了rspec,而不是通过spring?!

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/39415508

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档