lib/shoulda/macros.rb in technicalpickles-shoulda-2.0.1 vs lib/shoulda/macros.rb in technicalpickles-shoulda-2.0.2
- old
+ new
@@ -10,14 +10,11 @@
# should_not_change.
#
# Example:
#
# context "Creating a post"
- # setup do
- # Post.create
- # end
- #
+ # setup { Post.create }
# should_change "Post.count", :by => 1
# end
#
# As shown in this example, the <tt>:by</tt> option expects a numeric
# difference between the before and after values of the expression. You
@@ -55,13 +52,10 @@
# is run. This is the logical opposite of should_change.
#
# Example:
#
# context "Updating a post"
- # setup do
- # @post.update_attributes(:title => "new")
- # end
- #
+ # setup { @post.update_attributes(:title => "new") }
# should_not_change "Post.count"
# end
def should_not_change(expression)
expression_eval = lambda { eval(expression) }
before = lambda { @_before_should_not_change = expression_eval.bind(self).call }