forked from airbrake/airbrake
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathintegration_test.rb
executable file
·38 lines (29 loc) · 970 Bytes
/
integration_test.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env ruby
require 'logger'
require 'fileutils'
RAILS_ENV = "production"
RAILS_ROOT = FileUtils.pwd
RAILS_DEFAULT_LOGGER = Logger.new(STDOUT)
$: << File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
require 'airbrake'
require 'rails/init'
fail "Please supply an API Key as the first argument" if ARGV.empty?
host = ARGV[1]
host ||= "api.airbrake.io"
secure = (ARGV[2] == "secure")
exception = begin
raise "Testing airbrake notifier with secure = #{secure}. If you can see this, it works."
rescue => foo
foo
end
Airbrake.configure do |config|
config.secure = secure
config.host = host
config.api_key = ARGV.first
end
puts "Configuration:"
Airbrake.configuration.to_hash.each do |key, value|
puts sprintf("%25s: %s", key.to_s, value.inspect.slice(0, 55))
end
puts "Sending #{secure ? "" : "in"}secure notification to project with key #{ARGV.first}"
Airbrake.notify(exception)