The reason for this is that do...end
blocks bind at a different precedence level than {...}
blocks. Consider this expression:
expect { foo }.to change { x }
The { x }
block binds to change
, and is passed as a block to that method. However, if you use do...end
:
expect { foo }.to change do