module Habitat::TempConfig

Defined in:

habitat/temp_config.cr

Macro Summary

Macro Detail

macro temp_config(**settings_with_values) #

Temporarily changes the configuration

This method will change the configuration to the passed in value for the duration of the block. When the block is finished running, Habitat will then reset to the value before the block

MyServer.configure do |settings|
  settings.port = 80
end

MyServer.settings.port # 80

MyServer.temp_config(port: 3000) do
  MyServer.settings.port # 3000
end

MyServer.settings.port # 80

This can be very helpful when writing specs and you need to temporarily change a value


[View source]