In my config/initializers/transaction_logger.rb I have the following code
# config/initializers/transaction_logger.rb
Transaction::Logger.logger = Transaction::Logger.new("log/transations.log")
Every time I change the code and run the tests I get:
Failure/Error: delegate :info, :warn, :debug, :error, to: :logger
Module::DelegationError:
#<Class:Transaction::Logger>#error delegated to logger.error, but logger is nil: Transaction::Logger
I have to run spring stop
and then re-run the test again (seems initializer's code to be executing after spring stop
)
How should I set Transaction::Logger.logger
to avoid this problem? Thanks