我尝试了以下操作并得到了相关的错误:
Failure/Error: reminders_array.should be_an(Array)
NoMethodError:
undefined method `should' for #<Array:0x0000000202c9a0>
Run Code Online (Sandbox Code Playgroud)
prompts_array 应该是一个数组,我想用 Rspec 测试来检查它。我应该如何与上面的测试断言不同?
should 是旧语法,你应该这样做:
expect(reminders_array).to be_an(Array)
Run Code Online (Sandbox Code Playgroud)
或者:
expect(reminders_array).to be_an_instance_of(Array)
Run Code Online (Sandbox Code Playgroud)
您可以从rspec-expectations获取更多信息
| 归档时间: |
|
| 查看次数: |
341 次 |
| 最近记录: |