至于现在我在我的rspec测试中有这样的东西,它工作正常:
expect{
...
}.to change(@foo_array.first, :bar).from(3.14).to(69)
但是,不仅.first
而且每个@foo_array
的变化如何?
注意:重要的是不要多次执行...
个命令
答案 0 :(得分:0)
怎么样:
count = @foo_array.count
expect{
...
}.to change(@foo_array.map(&:bar)).from([3.14]*count).to([69]*count)