forked from airbrake/airbrake
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrails.feature
251 lines (230 loc) · 9.99 KB
/
rails.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
Feature: Install the Gem in a Rails application
Background:
Given I successfully run `rails new rails_root -O --skip-gemfile`
And I cd to "rails_root"
Scenario: Use the gem without vendoring the gem in a Rails application
When I configure the Airbrake shim
And I run `rails generate airbrake -k myapikey`
Then I should receive a Airbrake notification
And I should see the Rails version
Scenario: Configure the notifier by hand
When I configure the Airbrake shim
And I configure the notifier to use "myapikey" as an API key
And I run `rails generate airbrake`
Then I should receive a Airbrake notification
Scenario: Configuration within initializer isn't overridden by Railtie
When I configure the Airbrake shim
And I run `rails generate airbrake -k myapikey`
And I configure the notifier to use the following configuration lines:
"""
config.api_key = "myapikey"
config.project_root = "argle/bargle"
"""
And I define a response for "TestController#index":
"""
session[:value] = "test"
raise RuntimeError, "some message"
"""
And I route "/test/index" to "test#index"
And I perform a request to "http://example.com:123/test/index?param=value"
Then I should receive a Airbrake notification
Scenario: Try to install without an api key
And I run `rails generate airbrake`
Then I should see "Must pass --api-key or --heroku or create config/initializers/airbrake.rb"
Scenario: Configure and deploy using only installed gem
When I run `capify .`
And I configure the Airbrake shim
And I run `rails generate airbrake -k myapikey`
And I run `cap -T`
Then I should see "airbrake:deploy"
Scenario: Try to install when the airbrake plugin still exists
When I install the "airbrake" plugin
And I configure the Airbrake shim
And I configure the notifier to use "myapikey" as an API key
And I run `rails generate airbrake`
Then I should see "You must first remove the airbrake plugin. Please run: script/plugin remove airbrake"
Scenario: Rescue an exception in a controller
When I configure the Airbrake shim
And I run `rails generate airbrake -k myapikey`
And I define a response for "TestController#index":
"""
session[:value] = "test"
raise RuntimeError, "some message"
"""
And I route "/test/index" to "test#index"
And I perform a request to "http://example.com:123/test/index?param=value"
Then I should receive a Airbrake notification
Then I should see "test"
Scenario: The gem should not be considered a framework gem
When I configure the Airbrake shim
And I run `rails generate airbrake -k myapikey`
And I run `rake gems`
Then I should see that "airbrake" is not considered a framework gem
Scenario: The app uses Vlad instead of Capistrano
When I configure the Airbrake shim
And I run `touch config/deploy.rb`
And I run `rm Capfile`
And I run `rails generate airbrake -k myapikey`
Then "config/deploy.rb" should not contain "capistrano"
@wip
Scenario: Support the Heroku addon in the generator
When I configure the Airbrake shim
And I run `rails generate airbrake -k myapikey`
And I configure the Heroku shim with "myapikey"
And I successfully run `rails generate airbrake --heroku`
Then I should receive a Airbrake notification
And I should see the Rails version
And my Airbrake configuration should contain the following line:
"""
config.api_key = ENV['HOPTOAD_API_KEY']
"""
@wip
Scenario: Support the --app option for the Heroku addon in the generator
When I configure the Airbrake shim
And I configure the Heroku shim with "myapikey" and multiple app support
And I run `rails generate airbrake --heroku -a myapp`
Then I should receive a Airbrake notification
And I should see the Rails version
And my Airbrake configuration should contain the following line:
"""
config.api_key = ENV['HOPTOAD_API_KEY']
"""
Scenario: Filtering parameters in a controller
When I configure the Airbrake shim
And I run `rails generate airbrake -k myapikey`
When I configure the notifier to use the following configuration lines:
"""
config.api_key = "myapikey"
config.params_filters << "credit_card_number"
config.params_filters << "secret"
config.logger = Logger.new STDOUT
"""
And I define a response for "TestController#index":
"""
session["secret"] = "blue42"
params[:credit_card_number] = "red23"
raise RuntimeError, "some message"
"""
And I route "/test/index" to "test#index"
And I perform a request to "http://example.com:123/test/index?param=value" in the "production" environment
Then I should receive a Airbrake notification
Then I should not see "red23"
Then I should not see "blue42"
And I should see "FILTERED"
Scenario: Filtering session and params based on Rails parameter filters
When I configure the Airbrake shim
And I run `rails generate airbrake -k myapikey`
When I configure the notifier to use the following configuration lines:
"""
config.logger = Logger.new STDOUT
"""
And I configure the application to filter parameter "secret"
And I define a response for "TestController#index":
"""
params["secret"] = "red23"
session["secret"] = "blue42"
raise RuntimeError, "some message"
"""
And I route "/test/index" to "test#index"
And I perform a request to "http://example.com:123/test/index" in the "production" environment
Then I should receive a Airbrake notification
And I should not see "red23"
And I should not see "blue42"
And I should see "FILTERED"
Scenario: Notify airbrake within the controller
When I configure the Airbrake shim
And I run `rails generate airbrake -k myapikey`
And I define a response for "TestController#index":
"""
session[:value] = "test"
notify_airbrake(RuntimeError.new("some message"))
render :nothing => true
"""
And I route "/test/index" to "test#index"
And I perform a request to "http://example.com:123/test/index?param=value" in the "production" environment
Then I should receive a Airbrake notification
And I should see "test"
Scenario: Reporting 404s should be disabled by default
When I configure the Airbrake shim
And I configure the notifier to use the following configuration lines:
"""
config.api_key = "myapikey"
"""
And I perform a request to "http://example.com:123/this/route/does/not/exist" in the "production" environment
Then I should see "The page you were looking for doesn't exist."
And I should not receive a Airbrake notification
Scenario: Reporting 404s should work when configured properly
When I configure the Airbrake shim
And I run `rails generate airbrake -k myapikey`
When I configure the notifier to use the following configuration lines:
"""
config.ignore_only = []
"""
And I perform a request to "http://example.com:123/this/route/does/not/exist" in the "production" environment
Then I should see "The page you were looking for doesn't exist"
And I should receive a Airbrake notification
@wip
Scenario: reporting over SSL with utf8 check should work
When I configure the Airbrake shim
And I run `rails generate airbrake -k myapikey`
When I configure the notifier to use the following configuration lines:
"""
config.secure = true
"""
And I define a response for "TestController#index":
"""
raise RuntimeError, "some message"
"""
And I route "/test/index" to "test#index"
And I perform a request to "http://example.com:123/test/index?utf8=✓"
Then I should receive a Airbrake notification
Scenario: It should also send the user details
When I configure the Airbrake shim
And I configure the notifier to use the following configuration lines:
"""
config.api_key = "myapikey"
config.logger = Logger.new STDOUT
"""
And I define a response for "TestController#index":
"""
raise RuntimeError, "some message"
"""
And I route "/test/index" to "test#index"
And I have set up authentication system in my app that uses "current_user"
And I perform a request to "http://example.com:123/test/index" in the "production" environment
Then I should receive a Airbrake notification
And the Airbrake notification should contain user details
When I have set up authentication system in my app that uses "current_member"
And I perform a request to "http://example.com:123/test/index" in the "production" environment
Then I should receive a Airbrake notification
And the Airbrake notification should contain user details
Scenario: It should log the notice when failure happens
When Airbrake server is not responding
And I configure the notifier to use the following configuration lines:
"""
config.api_key = "myapikey"
config.logger = Logger.new STDOUT
"""
And I define a response for "TestController#index":
"""
raise RuntimeError, "some message"
"""
And I route "/test/index" to "test#index"
And I perform a request to "http://example.com:123/test/index?param=value" in the "production" environment
Then I should see "Notice details:"
And I should see "some message"
Scenario: It should send the framework info
When I configure the Airbrake shim
And I configure the notifier to use the following configuration lines:
"""
config.api_key = "myapikey"
config.logger = Logger.new STDOUT
"""
And I define a response for "TestController#index":
"""
raise RuntimeError, "some message"
"""
And I route "/test/index" to "test#index"
And I perform a request to "http://example.com:123/test/index" in the "production" environment
Then I should receive a Airbrake notification
And the Airbrake notification should contain the framework information