54: def should_change(description, options = {}, &block)
55: ::ActiveSupport::Deprecation.warn("Not considered a useful test. Instead, test the end state explicitly.")
56: by, from, to = get_options!([options], :by, :from, :to)
57: stmt = "change #{description}"
58: stmt << " from #{from.inspect}" if from
59: stmt << " to #{to.inspect}" if to
60: stmt << " by #{by.inspect}" if by
61:
62: before = lambda { @_before_should_change = block.bind(self).call }
63: should stmt, :before => before do
64: old_value = @_before_should_change
65: new_value = block.bind(self).call
66: assert_operator from, :===, old_value, "#{description} did not originally match #{from.inspect}" if from
67: assert_not_equal old_value, new_value, "#{description} did not change" unless by == 0
68: assert_operator to, :===, new_value, "#{description} was not changed to match #{to.inspect}" if to
69: assert_equal old_value + by, new_value if by
70: end
71: end