为什么rspec 3失败并出现错误:仅支持“接收消息”匹配器?
我正在尝试将项目从RSpec 2升级到RSpec 3,但失败,出现以下错误:为什么rspec 3失败并出现错误:仅支持“接收消息”匹配器?,rspec,rspec2,rspec3,Rspec,Rspec2,Rspec3,我正在尝试将项目从RSpec 2升级到RSpec 3,但失败,出现以下错误: Failure/Error: Unable to find matching line from backtrace only the `receive` or `receive_messages` matchers are supported with `expect(...).to`, but you have provided: #<RSpec::Matchers::BuiltIn::Equal:0
Failure/Error: Unable to find matching line from backtrace
only the `receive` or `receive_messages` matchers are supported with `expect(...).to`, but you have provided: #<RSpec::Matchers::BuiltIn::Equal:0x007f99a974a230>
只需
require 'rspec/expectations'
include RSpec::Matchers
但是,我已经这样做了,它仍然报告错误。似乎也遇到了这一问题,但截至2015年3月30日,尚未找到解决方案
我使用rspec,不使用黄瓜或菠菜
有人能解释一下如何在RSpec 3中解决这个错误吗?谢谢。对于
RSpec::Matchers
,我已使用extend
而不是include
纠正了此问题。在调试和尝试集成时,我建议进行更改
因此,我的代码现在看起来像:
extend RSpec::Matchers
而不是
include RSpec::Matchers
你确定你提到的那一行实际上给出了错误吗?
include RSpec::Matchers