module ThoughtBot::Shoulda::Macros

def should_not_change(expression)

end
should_not_change "Post.count"
setup { @post.update_attributes(:title => "new") }
context "Updating a post"

Example:

is run. This is the logical opposite of should_change.
of an expression that is run before and after the current setup block
Macro that creates a test asserting no change between the return value
def should_not_change(expression)
  expression_eval = lambda { eval(expression) }
  before = lambda { @_before_should_not_change = expression_eval.bind(self).call }
  should "not change #{expression.inspect}", :before => before do
    new_value = expression_eval.bind(self).call
    assert_equal @_before_should_not_change, new_value, "#{expression.inspect} changed"
  end
end