test/test_helper.rb in geocerts-0.0.23 vs test/test_helper.rb in geocerts-0.0.24
- old
+ new
@@ -63,6 +63,14 @@
rescue Exception
assert true # it wasn't the watched for exception.
end
end
+ def setting(object, method, options = {})
+ original_value = object.send(method)
+ object.send("#{method}=", options[:to])
+ yield if block_given?
+ ensure
+ object.send("#{method}=", options.has_key?(:back) ? options[:back] : original_value)
+ end
+
end