Chaining Multiple RSpec Change Matchers
It can be handy to use RSpec's change
matchers to determine if some method or process creates a new record.
But what if we are testing a method that creates a couple different records in the system?
RSpec allows us to chain together change
matchers with and
. Consider this additional contrived example.
In addition to keeping our tests tight and concise, this approach gives some pretty nice output on failure.
If we were just beginning our implementation with a failing test, we'd see a multi-part failure like the following.
Last updated