ruby-on-rails – Rspec 3弃用警告:不推荐使用example_group子
发布时间:2020-12-17 04:14:28 所属栏目:百科 来源:网络整理
导读:运行Rspec版本3测试时,我收到以下弃用警告: 不推荐使用:example_group subhash进行过滤.请使用subhash直接过滤.从/path/to/file.rb:6:in`block in’调用. 不推荐使用:example_group subhash进行过滤.请使用subhash直接过滤.从/path/to/file.rb:8:in`block
运行Rspec版本3测试时,我收到以下弃用警告:
不推荐使用:example_group subhash进行过滤.请使用subhash直接过滤.从/path/to/file.rb:6:in`block in’调用. 不推荐使用:example_group subhash进行过滤.请使用subhash直接过滤.从/path/to/file.rb:8:in`block in’调用. 从path /到/ file.rb: RSpec.configure do |config| module MyCodeHelpers # end config.include MyCodeHelpers,example_group: { :file_path => %r(spec/services/my_code) } config.before(:all,example_group: { :file_path => %r(spec/services/my_code) }) do @stub = true end end 这只是意味着删除:file_path值周围的’example_group:{}'(见下文)? config.include MyCodeHelpers,:file_path => %r(spec/services/my_code) 和 config.before(:all,:file_path => %r(spec/services/my_code)) do @stub = true end 解决方法
是的,这正是它所说的.它既适用于您设置元数据,也适用于您使用元数据时,通过查询或使用元数据来过滤config.include
有关原因的完整说明,请参阅this commit,但简而言之,他们认为当示例组的元数据具有关键的example_group时,该哈希仅具有示例组的元数据,这让人感到困惑 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |