forked from airbrake/airbrake
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsinatra.feature
56 lines (45 loc) · 1.45 KB
/
sinatra.feature
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
Feature: Use the notifier in a Sinatra app
Scenario: Rescue an exception in a Sinatra app
Given the following Rack app:
"""
require 'sinatra/base'
require 'airbrake'
require 'logger'
Airbrake.configure do |config|
config.api_key = 'my_api_key'
config.logger = Logger.new STDOUT
end
class FontaneApp < Sinatra::Base
use Airbrake::Sinatra
enable :raise_errors
get "/test/index" do
raise "Sinatra has left the building"
end
end
app = FontaneApp
"""
When I perform a Rack request to "http://example.com:123/test/index?param=value"
Then I should receive a Airbrake notification
Scenario: Catching environment name in modular Sinatra app
Given the following Rack app:
"""
require 'sinatra/base'
require 'airbrake'
require 'logger'
Airbrake.configure do |config|
config.api_key = 'my_api_key'
config.logger = Logger.new STDOUT
end
class FontaneApp < Sinatra::Base
use Airbrake::Sinatra
set :environment, :production
enable :raise_errors
get "/test/index" do
raise "Sinatra has left the building"
end
end
app = FontaneApp
"""
When I perform a Rack request to "http://example.com:123/test/index?param=value"
Then I should receive a Airbrake notification
And the output should contain "Env: production"