Is there a way to include the config_for settings in rspec tests? I have the following settings configured in config/initialisers/settings.rb:
SETTINGS = Rails.application.config_for(:settings)
but they aren't autoloaded in rspec and it triggers the following:
Failure/Error: generator = SETTINGS['my_strategy'].constantize.new(file)
NoMethodError:
undefined method `constantize' for nil:NilClass
As it isn't a module or class, I can't include it in the normal way and doing something as:
config.include Rails.application, type: :controller
Is in my opinion, not the proper thing to do.
After some digging I couldn't find a rspec helper which can load the config_for settings. I solved this by doing the following:
before :all do
SETTINGS['my_strategy'] = 'StrategyClass'
end
Which solved the loading of the constant.