我的测试看起来像这样:第一个月我的方法返回如下:fail 'Unknown subscription model type!'个然而,Rspec返回了这个失败消息:Failure/Error: expect(helper.description_for_subscription(recurring_plan)).to raise_error(RuntimeError) RuntimeError: Unknown subscription model type!个“怎么了?
fail 'Unknown subscription model type!'
Failure/Error: expect(helper.description_for_subscription(recurring_plan)).to raise_error(RuntimeError) RuntimeError: Unknown subscription model type!
sqyvllje1#
你应该将期望值 Package 在一个块中,使用{}而不是():
{}
()
expect{ helper.description_for_subscription(recurring_plan) }.to raise_error(RuntimeError)
字符串检查预期错误部分here
1条答案
按热度按时间sqyvllje1#
你应该将期望值 Package 在一个块中,使用
{}
而不是()
:字符串
检查预期错误部分here