$ command line ruby cheat sheets
Cheat Sheet Title: [ no_spaces_alphanumeric_only ]
Cheat Sheet:assert_no_difference -- an assertion for your testing suite Usage: assert_no_difference 'Model.count' do puts "blah" end Synonym for: assert_difference 'Model.count', 0 do puts "blah" #or any action that will NOT change the argument. end This is useful for when you are testing benign actions or, even better, when you have fail-safes that allow an action to be executed but do not actually affect the database. For instance, you've got an action that is protected by authentication and you don't want to broadcast its existance to anyone with lesser permissions. If an unauthenticated use navigates to the action, just let them see nothing (render :nothing => true or something to that effect) and chug along without caring.
Your cheat sheet will be editable (fixable) by anyone. Each cheat sheet is essentially a wiki page. It may also be used by millions of people for reference purposes from the comfort of their command line. If this is okay with you, please save.
Advertisement