Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions lib/raven/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,15 @@ def client
end

# Tell the log that the client is good to go
def report_ready
logger.info "Raven #{VERSION} ready to catch errors"
def report_status
return if client.configuration.silence_ready
if client.configuration.send_in_current_environment?
logger.info "Raven #{VERSION} ready to catch errors"
else
logger.info "Raven #{VERSION} configured not to send errors."
end
end
alias_method :report_ready, :report_status

# Call this method to modify defaults in your initializers.
#
Expand All @@ -63,7 +69,7 @@ def configure
yield(configuration) if block_given?

self.client = Client.new(configuration)
report_ready unless client.configuration.silence_ready
report_status
self.client
end

Expand Down
29 changes: 29 additions & 0 deletions spec/raven/raven_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,35 @@ def ivars(object)
end
end

describe '.report_status' do
let(:ready_message) do
"Raven #{Raven::VERSION} ready to catch errors"
end

let(:not_ready_message) do
"Raven #{Raven::VERSION} configured not to send errors."
end

it 'logs a ready message when configured' do
Raven.configuration.silence_ready = false
expect(Raven.configuration).to(
receive(:send_in_current_environment?).and_return(true))
expect(Raven.logger).to receive(:info).with(ready_message)
Raven.report_status
end

it 'logs not ready message if the config does not send in current environment' do
Raven.configuration.silence_ready = false
expect(Raven.configuration).to(
receive(:send_in_current_environment?).and_return(false))
expect(Raven.logger).to receive(:info).with(not_ready_message)
Raven.report_status
end

it 'logs nothing if "silence_ready" configuration is true' do
Raven.configuration.silence_ready = true
expect(Raven.logger).not_to receive(:info)
Raven.report_status
end
end
end