How about:
count = @foo_array.count
expect{
...
}.to change(@foo_array.map(&:bar)).from([3.14]*count).to([69]*count)
Pergunta
As for now I have something like this in my rspec test and it works fine:
expect{
...
}.to change(@foo_array.first, :bar).from(3.14).to(69)
But how to expect the change not only for .first
but for every at @foo_array
?
Note: important is to don't execute ...
commands multiple times
Solução
How about:
count = @foo_array.count
expect{
...
}.to change(@foo_array.map(&:bar)).from([3.14]*count).to([69]*count)