Posted By


vanne on 01/21/07

Tagged


Statistics


Viewed 658 times
Favorited by 1 user(s)

Related snippets


assert_difference


/ Published in: Ruby
Save to your folder(s)

A custom assertion that will allow you to pass a block to find the difference between two values.


Copy this code and paste it in your HTML
  1. def assert_difference(object, method, difference=1)
  2. initial_value = object.send(method)
  3. yield
  4. assert_equal initial_value + difference, object.send(method)
  5. end

URL: http://weblog.jamisbuck.org/2007/1/19/blocks-rock

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.