I need to test some Rails code, but for the duration of my test I would like to override some configuration options.
With Python background, I would do this like:
def test():
# ...
with change_config(key, new_value):
# do stuff with config changed
# config is back to old value
How would I achieve this in Rails/Ruby?
Does this work?
def test
Rails.config.action_mailer.delivery_method = :test
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With