【发布时间】:2023-03-15 06:15:02
【问题描述】:
我正在尝试将项目从 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:0x007f99a974a230>
下面是一行:
expect(last_response.ok?).to be true
This post suggests只需要一个
require 'rspec/expectations'
include RSpec::Matchers
但是,我已经这样做了,它仍然报告错误。 This user 似乎也遇到了这个问题,但截至 2015 年 3 月 30 日还没有找到解决方案。
我将 rspec 与 Sinatra 一起使用,不使用黄瓜或菠菜。
谁能解释如何解决 RSpec 3 中的这个错误?谢谢。
【问题讨论】:
-
你确定你提到的那一行实际上是在给出错误吗?