Skip to content

Instantly share code, notes, and snippets.

@murdoch
Created October 29, 2013 00:28
Show Gist options
  • Save murdoch/7207237 to your computer and use it in GitHub Desktop.
Save murdoch/7207237 to your computer and use it in GitHub Desktop.
Rspec "expect" snippets found on Stackoverflow
expect { thing.destroy }.to change(Thing, :count).from(1).to(0)
expect { thing.tax = 5 }.to change { thing.total_price }.by(5)
expect { thing.save! }.to raise_error
expect { thing.symbolize_name }.to change { thing.name }.from(String).to(Symbol)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment