More readable value change testing in rspec
Some simple but effectiverspec
syntax that I just learned:
expect{Object.method}.to change{Object.count}.from(0).to(1)
I think this is fairly straightforward, but essentially it just lets you test for value changes. This is basically just a clearer way of writing expectations and would replace something like this:
expect(Object.count).to eq(0)
Object.method
expect(Object.count).to eq(1)
Check the rspec docs for more details.