Hey Guys,
I’m trying to mock the Rails Logger for the following code:
…
rescue TimeoutError => error
$logger.error("#{self.name} Timeout for #{path}: #{error}") and
return
rescue SocketError => error
$logger.error("#{self.name} SocketError for #{path}: #{error}")
and
return
rescue StandardError => error
$logger.error("#{self.name} Error for #{path}: #{error}") and
return
end
…
my failed attempt to spec:
logger = mock_model(Logger)
logger.stub(:error)
logger.should_receive(:error).with(:any_args)
Do you know of any solution for mocking this?
Also, do you think the Rails Logger is worth mocking?
Thanks very much in Advance,