OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
openproject/spec/support/settings.rb

10 lines
317 B

##
# Runs block with settings specified in options.
# The original settings are restored afterwards.
def with_settings(options, &block)
saved_settings = options.keys.inject({}) {|h, k| h[k] = Setting[k].dup; h}
options.each {|k, v| Setting[k] = v}
yield
ensure
saved_settings.each {|k, v| Setting[k] = v}
end