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
6 changes: 5 additions & 1 deletion lib/raven/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@ def self.test(dsn = nil)
end

if evt && !(evt.is_a? Thread)
puts "-> event ID: #{evt.id}"
if evt.is_a? Hash
puts "-> event ID: #{evt[:event_id]}"
else
puts "-> event ID: #{evt.id}"
end
elsif evt #async configuration
puts "-> event ID: #{evt.value.id}"
else
Expand Down
40 changes: 40 additions & 0 deletions spec/raven/cli_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
require 'spec_helper'

describe "CLI tests" do

example "posting an exception" do
stubs = Faraday::Adapter::Test::Stubs.new do |stub|
stub.post('sentry/api/42/store/') { [200, {}, 'ok'] }
end

Raven.configure do |config|
config.server = 'http://12345:67890@sentry.localdomain/sentry/42'
config.environments = ["test"]
config.current_environment = "test"
config.http_adapter = [:test, stubs]
end

expect { Raven::CLI.test }.not_to raise_error

stubs.verify_stubbed_calls
end

example "posting an exception to a prefixed DSN" do

stubs = Faraday::Adapter::Test::Stubs.new do |stub|
stub.post('/prefix/sentry/api/42/store/') { [200, {}, 'ok'] }
end

Raven.configure do |config|
config.environments = ["test"]
config.current_environment = "test"
config.http_adapter = [:test, stubs]
end

expect {
Raven::CLI.test 'http://12345:67890@sentry.localdomain/prefix/sentry/42'
}.not_to raise_error

stubs.verify_stubbed_calls
end
end