是否有可能期望 RSpec double 被调用两次并具有不同的值?

Is it possible to expect an RSpec double be called twice with varying values?

在 RSpec 的 mock docs 我发现
期望(双).接收(:味精).exactly(3).times.and_return(value1, value2, value3)
# returns 第一次是 value1,第二次是 value2,依此类推`

如果我使用相同的 with 参数,例如
期望(双).接收(:味精).exactly(3).times.with(value1, value2, value3)
RSpec 自然期望 msg 被调用 value1, value2, value3 三次。
有没有办法说 called the first time with value1, the second time with value 2, etc?

尝试使用 .ordered,像这样:

expect(double).to receive(:msg).with(value1).ordered
expect(double).to receive(:msg).with(value2).ordered
expect(double).to receive(:msg).with(value3).ordered