airbrake 3.1.6 → 3.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. data/CHANGELOG +116 -0
  2. data/LICENSE +61 -0
  3. data/README.md +28 -478
  4. data/README_FOR_HEROKU_ADDON.md +13 -5
  5. data/Rakefile +26 -103
  6. data/TESTED_AGAINST +6 -0
  7. data/airbrake.gemspec +13 -14
  8. data/features/metal.feature +27 -12
  9. data/features/rack.feature +59 -59
  10. data/features/rails.feature +79 -100
  11. data/features/rails_with_js_notifier.feature +9 -21
  12. data/features/rake.feature +6 -4
  13. data/features/sinatra.feature +32 -6
  14. data/features/step_definitions/file_steps.rb +4 -0
  15. data/features/step_definitions/rack_steps.rb +9 -5
  16. data/features/step_definitions/rails_application_steps.rb +46 -278
  17. data/features/step_definitions/rake_steps.rb +16 -11
  18. data/features/support/airbrake_shim.rb.template +0 -2
  19. data/features/support/aruba.rb +5 -0
  20. data/features/support/env.rb +12 -6
  21. data/features/support/rails.rb +30 -73
  22. data/features/support/rake/Rakefile +1 -2
  23. data/features/user_informer.feature +12 -19
  24. data/generators/airbrake/airbrake_generator.rb +1 -1
  25. data/lib/airbrake.rb +9 -8
  26. data/lib/airbrake/cli/project_factory.rb +6 -3
  27. data/lib/airbrake/configuration.rb +7 -0
  28. data/lib/airbrake/notice.rb +52 -3
  29. data/lib/airbrake/rack.rb +16 -7
  30. data/lib/airbrake/rails/action_controller_catcher.rb +5 -3
  31. data/lib/airbrake/rails/controller_methods.rb +6 -6
  32. data/lib/airbrake/rails/error_lookup.rb +4 -2
  33. data/lib/airbrake/rails/javascript_notifier.rb +7 -3
  34. data/lib/airbrake/rails/middleware.rb +65 -0
  35. data/lib/airbrake/rails3_tasks.rb +16 -21
  36. data/lib/airbrake/railtie.rb +9 -16
  37. data/lib/airbrake/rake_handler.rb +2 -2
  38. data/lib/airbrake/sender.rb +57 -6
  39. data/lib/airbrake/shared_tasks.rb +24 -11
  40. data/lib/airbrake/sinatra.rb +34 -0
  41. data/lib/airbrake/user_informer.rb +9 -0
  42. data/lib/airbrake/version.rb +1 -1
  43. data/lib/rails/generators/airbrake/airbrake_generator.rb +10 -10
  44. data/{test/airbrake_2_3.xsd → resources/airbrake_2_4.xsd} +1 -0
  45. data/resources/airbrake_3_0.json +52 -0
  46. data/test/catcher_test.rb +198 -240
  47. data/test/configuration_test.rb +2 -0
  48. data/test/helper.rb +123 -53
  49. data/test/notice_test.rb +45 -1
  50. data/test/sender_test.rb +63 -32
  51. metadata +60 -79
  52. data/MIT-LICENSE +0 -22
  53. data/SUPPORTED_RAILS_VERSIONS +0 -38
  54. data/TESTING.md +0 -41
  55. data/features/step_definitions/metal_steps.rb +0 -23
  56. data/features/support/terminal.rb +0 -107
  57. data/lib/airbrake/extensions/blank.rb +0 -73
  58. data/lib/airbrake/rails/middleware/exceptions_catcher.rb +0 -33
@@ -15,7 +15,7 @@ To use Airbrake on Heroku, install the Airbrake add-on:
15
15
  After adding the Airbrake add-on, you will need to install and configure the Airbrake notifier.
16
16
 
17
17
  Your application connects to Airbrake with an API key. On Heroku, this is automatically provided to your
18
- application in `ENV['HOPTOAD_API_KEY']`, so installation should be a snap! (Hoptoad is Airbrake's old name.)
18
+ application in `ENV['AIRBRAKE_API_KEY']`, so installation should be a snap!
19
19
 
20
20
  ### Rails 3.x
21
21
 
@@ -57,7 +57,7 @@ In order to use airbrake in a non-Rails rack app, just load the airbrake, config
57
57
  require 'airbrake'
58
58
 
59
59
  Airbrake.configure do |config|
60
- config.api_key = `ENV['HOPTOAD_API_KEY']`
60
+ config.api_key = `ENV['AIRBRAKE_API_KEY']`
61
61
  end
62
62
 
63
63
  app = Rack::Builder.app do
@@ -67,8 +67,8 @@ In order to use airbrake in a non-Rails rack app, just load the airbrake, config
67
67
 
68
68
  ### Rails 1.x
69
69
 
70
- For Rails 1.x, visit the [Airbrake notifier's README on GitHub](http://github.com/thoughtbot/airbrake),
71
- and be sure to use `ENV['HOPTOAD_API_KEY']` where your API key is required in configuration code.
70
+ For Rails 1.x, visit the [Airbrake's README on GitHub](http://github.com/airbrake/airbrake),
71
+ and be sure to use `ENV['AIRBRAKE_API_KEY']` where your API key is required in configuration code.
72
72
 
73
73
  3. Configure your notification settings (important!)
74
74
  ---------------------------------------------------
@@ -82,7 +82,7 @@ Airbrake can deliver exception notifications to your email inbox. To configure
82
82
 
83
83
  1. Visit your applications resources page, like [ http://api.heroku.com/myapps/my-great-app/resources ](http://api.heroku.com/myapps/my-great-app/resources).
84
84
  2. Click the name of your Airbrake addon. (It may still be called Hoptoad.)
85
- 3. Click "Settings" to configure the Hoptoad Add-on.
85
+ 3. Click "Settings" to configure the Airbrake Add-on.
86
86
 
87
87
  4. Optionally: Set up deploy notification
88
88
  -----------------------------------------
@@ -92,3 +92,11 @@ If your Airbrake plan supports deploy notification, set it up for your Heroku ap
92
92
  rake airbrake:heroku:add_deploy_notification
93
93
 
94
94
  This will install a Heroku [HTTP Deploy Hook](http://docs.heroku.com/deploy-hooks) to notify Airbrake of the deploy.
95
+
96
+ You can pass in additional information for the deploy hook, in the ENV. Here are the available parameters:
97
+ * `ENV["RAILS_ENV"]` - Rails environment you're deploying to, if not set on Heroku
98
+ * `ENV["AIRBRAKE_API_KEY"]` - API key if not saved on Heroku or in initializer
99
+ * `ENV["HEROKU_APP"]` - app name if you have multiple Heroku apps
100
+ * `ENV["REPO"]` - Github url of the repo you're deploying, set this if you're not using remote named "origin"
101
+
102
+ We will also set "username" and "revision" from Heroku variables.
data/Rakefile CHANGED
@@ -1,3 +1,6 @@
1
+ require 'rubygems'
2
+ require "bundler/setup"
3
+ require 'appraisal'
1
4
  require 'rake'
2
5
  require 'rake/testtask'
3
6
  require 'rubygems/package_task'
@@ -9,14 +12,11 @@ rescue LoadError
9
12
  end
10
13
  require './lib/airbrake/version'
11
14
 
12
- FEATURES = ["sinatra","rack","metal","user_informer","rake"]
13
-
14
- desc 'Default: run unit tests.'
15
- task :default => [:test, "cucumber:rails:all"] + FEATURES
16
-
17
- desc "Clean out the tmp directory"
18
- task :clean do
19
- exec "rm -rf tmp"
15
+ task :default do
16
+ exec 'rake appraisal:rails-3.0 test '\
17
+ '&& rake appraisal:rails-3.1 test '\
18
+ '&& rake appraisal:rails-3.2 test '\
19
+ '&& rake appraisal cucumber'\
20
20
  end
21
21
 
22
22
  desc 'Test the airbrake gem.'
@@ -118,106 +118,29 @@ desc "Clean files generated by rake tasks"
118
118
  task :clobber => [:clobber_rdoc, :clobber_package]
119
119
 
120
120
  LOCAL_GEM_ROOT = File.join(GEM_ROOT, 'tmp', 'local_gems').freeze
121
- RAILS_VERSIONS = IO.read('SUPPORTED_RAILS_VERSIONS').strip.split("\n")
122
- LOCAL_GEMS =
123
- [
124
- ["rack","1.3.2"],
125
- ] +
126
- RAILS_VERSIONS.collect { |version| ['rails', version] } +
127
- [
128
- ['sham_rack', nil],
129
- ['capistrano', nil],
130
- ['sqlite3-ruby', nil],
131
- ["therubyracer",nil],
132
- ["sinatra",nil]
133
- ]
134
-
135
-
136
- desc "Vendor test gems: Run this once to prepare your test environment"
137
- task :vendor_test_gems do
138
- old_gem_path = ENV['GEM_PATH']
139
- old_gem_home = ENV['GEM_HOME']
140
- ENV['GEM_PATH'] = LOCAL_GEM_ROOT
141
- ENV['GEM_HOME'] = LOCAL_GEM_ROOT
142
-
143
- LOCAL_GEMS.each do |gem_name, version|
144
- gem_file_pattern = [gem_name, version || '*'].compact.join('-')
145
- version_option = version ? "-v #{version}" : ''
146
- pattern = File.join(LOCAL_GEM_ROOT, 'gems', "#{gem_file_pattern}")
147
- existing = Dir.glob(pattern).first
148
- if existing
149
- puts "\nskipping #{gem_name} since it's already vendored," +
150
- "remove it from the tmp directory first."
151
- next
152
- end
153
121
 
154
- command = "gem install -i #{LOCAL_GEM_ROOT} --no-ri --no-rdoc --backtrace #{version_option} #{gem_name}"
155
- puts "Vendoring #{gem_file_pattern}..."
156
- unless system("#{command} 2>&1")
157
- puts "Command failed: #{command}"
158
- exit(1)
159
- end
122
+ # Helper method that's used to only include relevant features when using
123
+ # various gemfiles. We don't want to, for instance, test sinatra features when
124
+ # using the rails gemfile and vice versa.
125
+ def cucumber_opts
126
+ opts = "--tags ~@wip --format progress "
127
+
128
+ opts << ENV["FEATURE"] and return if ENV["FEATURE"]
129
+
130
+ case ENV["BUNDLE_GEMFILE"]
131
+ when /rails/
132
+ opts << "features/rails.feature features/rails_with_js_notifier.feature features/metal.feature features/user_informer.feature"
133
+ when /rack/
134
+ opts << "features/rack.feature"
135
+ when /sinatra/
136
+ opts << "features/sinatra.feature"
137
+ when /rake/
138
+ opts << "features/rake.feature"
160
139
  end
161
-
162
- ENV['GEM_PATH'] = old_gem_path
163
- ENV['GEM_HOME'] = old_gem_home
164
140
  end
165
141
 
166
142
  Cucumber::Rake::Task.new(:cucumber) do |t|
167
143
  t.fork = true
168
- t.cucumber_opts = ['--format', (ENV['CUCUMBER_FORMAT'] || 'progress')]
169
- end
170
-
171
- task :cucumber => [:vendor_test_gems]
172
-
173
-
174
- def run_rails_cucumber_task(version, additional_cucumber_args)
175
- puts "Testing Rails #{version}"
176
- if version.empty?
177
- raise "No Rails version specified - make sure ENV['RAILS_VERSION'] is set, e.g. with `rake cucumber:rails:all`"
178
- end
179
- ENV['RAILS_VERSION'] = version
180
- cmd = "cucumber --format #{ENV['CUCUMBER_FORMAT'] || 'progress'} #{additional_cucumber_args} features/rails.feature features/rails_with_js_notifier.feature"
181
- puts "Running command: #{cmd}"
182
- system(cmd)
183
- end
184
-
185
- def define_rails_cucumber_tasks(additional_cucumber_args = '')
186
- namespace :rails do
187
- RAILS_VERSIONS.each do |version|
188
- desc "Test integration of the gem with Rails #{version}"
189
- task version => [:vendor_test_gems] do
190
- exit 1 unless run_rails_cucumber_task(version, additional_cucumber_args)
191
- end
192
- end
193
-
194
- desc "Test integration of the gem with all Rails versions"
195
- task :all do
196
- results = RAILS_VERSIONS.map do |version|
197
- run_rails_cucumber_task(version, additional_cucumber_args)
198
- end
199
-
200
- exit 1 unless results.all?
201
- end
202
- end
144
+ t.cucumber_opts = cucumber_opts
203
145
  end
204
146
 
205
- namespace :cucumber do
206
- namespace :wip do
207
- define_rails_cucumber_tasks('--tags @wip')
208
- end
209
-
210
- define_rails_cucumber_tasks
211
-
212
- rule /#{"(" + FEATURES.join("|") + ")"}/ do |t|
213
- framework = t.name
214
- desc "Test integration of the gem with #{framework}"
215
- task framework.to_sym do
216
- puts "Testing #{framework.split(":").last}..."
217
- cmd = "cucumber --format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features/#{framework.split(":").last}.feature"
218
- puts "Running command: #{cmd}"
219
- system(cmd)
220
- end
221
- end
222
-
223
- end
data/TESTED_AGAINST ADDED
@@ -0,0 +1,6 @@
1
+ Rails 3.0.19
2
+ Rails 3.1.10
3
+ Rails 3.2.11
4
+ Sinatra 1.3.3
5
+ Rack 1.4.3
6
+ Rake 10.0.3
data/airbrake.gemspec CHANGED
@@ -8,29 +8,28 @@ Gem::Specification.new do |s|
8
8
  s.summary = %q{Send your application errors to our hosted service and reclaim your inbox.}
9
9
 
10
10
  s.require_paths = ["lib"]
11
- s.executables << "airbrake"
11
+ s.executables << "airbrake"
12
12
  s.files = Dir["{generators/**/*,lib/**/*,rails/**/*,resources/*,script/*}"] +
13
- %w(airbrake.gemspec CHANGELOG Gemfile Guardfile INSTALL MIT-LICENSE Rakefile README_FOR_HEROKU_ADDON.md README.md TESTING.md SUPPORTED_RAILS_VERSIONS install.rb)
13
+ %w(airbrake.gemspec CHANGELOG Gemfile Guardfile INSTALL LICENSE Rakefile README_FOR_HEROKU_ADDON.md README.md TESTED_AGAINST install.rb)
14
14
  s.test_files = Dir.glob("{test,spec,features}/**/*")
15
15
 
16
16
  s.add_runtime_dependency("builder")
17
- s.add_runtime_dependency("girl_friday")
17
+ s.add_runtime_dependency("activesupport")
18
+ s.add_runtime_dependency("json")
18
19
 
19
- s.add_development_dependency("actionpack", "~> 2.3.8")
20
- s.add_development_dependency("activerecord", "~> 2.3.8")
21
- s.add_development_dependency("activesupport", "~> 2.3.8")
22
- s.add_development_dependency("mocha", "0.10.5")
23
- s.add_development_dependency("bourne", ">= 1.0")
24
- s.add_development_dependency("cucumber", "~> 0.10.6")
20
+ s.add_development_dependency("bourne", ">= 1.0")
21
+ s.add_development_dependency("cucumber-rails","~> 1.1.1")
25
22
  s.add_development_dependency("fakeweb", "~> 1.3.0")
26
- s.add_development_dependency("nokogiri", "~> 1.4.3.1")
23
+ s.add_development_dependency("nokogiri", "~> 1.5.0")
27
24
  s.add_development_dependency("rspec", "~> 2.6.0")
28
25
  s.add_development_dependency("sham_rack", "~> 1.3.0")
29
26
  s.add_development_dependency("shoulda", "~> 2.11.3")
30
- s.add_development_dependency("capistrano", "~> 2.8.0")
31
- s.add_development_dependency("guard" )
32
- s.add_development_dependency("guard-test" )
33
- s.add_development_dependency("simplecov" )
27
+ s.add_development_dependency("capistrano")
28
+ s.add_development_dependency("aruba")
29
+ s.add_development_dependency("appraisal")
30
+ s.add_development_dependency("rspec-rails")
31
+ s.add_development_dependency("girl_friday")
32
+ s.add_development_dependency("json-schema")
34
33
 
35
34
  s.authors = ["Airbrake"]
36
35
  s.email = %q{support@airbrake.io}
@@ -1,18 +1,33 @@
1
1
  Feature: Rescue errors in Rails middleware
2
-
3
2
  Background:
4
- Given I have built and installed the "airbrake" gem
5
- And I generate a new Rails application
3
+ Given I successfully run `rails new rails_root -O --without-gemfile`
4
+ And I cd to "rails_root"
5
+ And I configure the notifier to use the following configuration lines:
6
+ """
7
+ config.logger = Logger.new STDOUT
8
+ """
6
9
  And I configure the Airbrake shim
7
- And I configure my application to require the "airbrake" gem
8
- And I run the airbrake generator with "-k myapikey"
9
-
10
- Scenario: Rescue an exception in the dispatcher
11
- When I define a Metal endpoint called "Exploder":
12
- """
13
- def self.call(env)
14
- raise "Explode"
10
+ And I append to "app/metal/exploder.rb" with:
11
+ """
12
+ class Exploder
13
+ def call(env)
14
+ raise "Explode!"
15
+ end
15
16
  end
16
- """
17
+ """
18
+ And I remove the file "config/routes.rb"
19
+ And I append to "config/routes.rb" with:
20
+ """
21
+ RailsRoot::Application.routes.draw do
22
+ mount Exploder.new => "/"
23
+ end
24
+ """
25
+
26
+ Scenario: It should not report to Airbrake in development
17
27
  When I perform a request to "http://example.com:123/metal/index?param=value"
28
+ Then I should not receive a Airbrake notification
29
+
30
+ Scenario: It should report to Airbrake in production
31
+ When I perform a request to "http://example.com:123/metal/index?param=value" in the "production" environment
18
32
  Then I should receive a Airbrake notification
33
+
@@ -1,60 +1,60 @@
1
1
  Feature: Use the notifier in a plain Rack app
2
-
3
- Background:
4
- Given I have built and installed the "airbrake" gem
5
-
6
- Scenario: Rescue and exception in a Rack app
7
- Given the following Rack app:
8
- """
9
- require 'logger'
10
- require 'rack'
11
- require 'airbrake'
12
-
13
- Airbrake.configure do |config|
14
- config.api_key = 'my_api_key'
15
- config.logger = Logger.new STDOUT
16
- end
17
-
18
- app = Rack::Builder.app do
19
- use Airbrake::Rack
20
- run lambda { |env| raise "Rack down" }
21
- end
22
- """
23
- When I perform a Rack request to "http://example.com:123/test/index?param=value"
24
- Then I should receive a Airbrake notification
25
-
26
- Scenario: Ignore user agents
27
- Given the following Rack app:
28
- """
29
- require 'logger'
30
- require 'rack'
31
- require 'airbrake'
32
-
33
- Airbrake.configure do |config|
34
- config.api_key = 'my_api_key'
35
- config.ignore_user_agent << /ignore/
36
- config.logger = Logger.new STDOUT
37
- end
38
-
39
- class Mock
40
- class AppendUserAgent
41
- def initialize(app)
42
- @app = app
43
- end
44
-
45
- def call(env)
46
- env["HTTP_USER_AGENT"] = "ignore"
47
- @app.call(env)
48
- end
49
- end
50
- end
51
-
52
- app = Rack::Builder.app do
53
- use Airbrake::Rack
54
- use Mock::AppendUserAgent
55
- run lambda { |env| raise "Rack down" }
56
- end
57
- """
58
- When I perform a Rack request to "http://example.com:123/test/index?param=value"
59
- Then I should not see "** [Airbrake] Response from Airbrake:"
60
-
2
+
3
+ Scenario: Rescue and exception in a Rack app
4
+
5
+ Given the following Rack app:
6
+ """
7
+ require 'logger'
8
+ require 'rack'
9
+ require 'airbrake'
10
+
11
+ Airbrake.configure do |config|
12
+ config.api_key = 'my_api_key'
13
+ config.logger = Logger.new STDOUT
14
+ end
15
+
16
+ app = Rack::Builder.app do
17
+ use Airbrake::Rack
18
+ run lambda { |env| raise "Rack down" }
19
+ end
20
+
21
+ """
22
+ When I perform a Rack request to "http://example.com:123/test/index?param=value"
23
+ Then I should receive a Airbrake notification
24
+
25
+ Scenario: Ignore user agents
26
+
27
+ Given the following Rack app:
28
+ """
29
+ require 'logger'
30
+ require 'rack'
31
+ require 'airbrake'
32
+
33
+ Airbrake.configure do |config|
34
+ config.api_key = 'my_api_key'
35
+ config.ignore_user_agent << /ignore/
36
+ config.logger = Logger.new STDOUT
37
+ end
38
+
39
+ class Mock
40
+ class AppendUserAgent
41
+ def initialize(app)
42
+ @app = app
43
+ end
44
+
45
+ def call(env)
46
+ env["HTTP_USER_AGENT"] = "ignore"
47
+ @app.call(env)
48
+ end
49
+ end
50
+ end
51
+
52
+ app = Rack::Builder.app do
53
+ use Airbrake::Rack
54
+ use Mock::AppendUserAgent
55
+ run lambda { |env| raise "Rack down" }
56
+ end
57
+
58
+ """
59
+ When I perform a Rack request to "http://example.com:123/test/index?param=value"
60
+ Then I should not receive a Airbrake notification
@@ -1,41 +1,25 @@
1
1
  Feature: Install the Gem in a Rails application
2
2
 
3
3
  Background:
4
- Given I have built and installed the "airbrake" gem
5
- And I generate a new Rails application
4
+ Given I successfully run `rails new rails_root -O --skip-gemfile`
5
+ And I cd to "rails_root"
6
6
 
7
7
  Scenario: Use the gem without vendoring the gem in a Rails application
8
8
  When I configure the Airbrake shim
9
- And I configure my application to require the "airbrake" gem
10
- And I run the airbrake generator with "-k myapikey"
11
- Then the command should have run successfully
12
- And I should receive a Airbrake notification
9
+ And I run `rails generate airbrake -k myapikey`
10
+ Then I should receive a Airbrake notification
13
11
  And I should see the Rails version
14
12
 
15
- Scenario: vendor the gem and uninstall
16
- When I configure the Airbrake shim
17
- And I configure my application to require the "airbrake" gem
18
- And I unpack the "airbrake" gem
19
- And I run the airbrake generator with "-k myapikey"
20
- Then the command should have run successfully
21
- When I uninstall the "airbrake" gem
22
- And I install cached gems
23
- And I run "rake airbrake:test"
24
- Then I should see "** [Airbrake] Response from Airbrake:"
25
- And I should receive two Airbrake notifications
26
-
27
13
  Scenario: Configure the notifier by hand
28
14
  When I configure the Airbrake shim
29
15
  And I configure the notifier to use "myapikey" as an API key
30
- And I configure my application to require the "airbrake" gem
31
- And I run the airbrake generator with ""
16
+ And I run `rails generate airbrake`
32
17
  Then I should receive a Airbrake notification
33
18
 
34
19
  Scenario: Configuration within initializer isn't overridden by Railtie
35
20
  When I configure the Airbrake shim
36
- And I configure usage of Airbrake
37
- Then the command should have run successfully
38
- When I configure the notifier to use the following configuration lines:
21
+ And I run `rails generate airbrake -k myapikey`
22
+ And I configure the notifier to use the following configuration lines:
39
23
  """
40
24
  config.api_key = "myapikey"
41
25
  config.project_root = "argle/bargle"
@@ -50,42 +34,26 @@ Feature: Install the Gem in a Rails application
50
34
  Then I should receive a Airbrake notification
51
35
 
52
36
  Scenario: Try to install without an api key
53
- When I configure my application to require the "airbrake" gem
54
- And I run the airbrake generator with ""
37
+ And I run `rails generate airbrake`
55
38
  Then I should see "Must pass --api-key or --heroku or create config/initializers/airbrake.rb"
56
39
 
57
40
  Scenario: Configure and deploy using only installed gem
58
- When I run "capify ."
41
+ When I run `capify .`
59
42
  And I configure the Airbrake shim
60
- And I configure my application to require the "airbrake" gem
61
- And I run the airbrake generator with "-k myapikey"
62
- And I configure my application to require the "capistrano" gem if necessary
63
- And I run "cap -T"
64
- Then I should see "airbrake:deploy"
65
-
66
- Scenario: Configure and deploy using only vendored gem
67
- When I run "capify ."
68
- And I configure the Airbrake shim
69
- And I configure my application to require the "airbrake" gem
70
- And I unpack the "airbrake" gem
71
- And I run the airbrake generator with "-k myapikey"
72
- And I uninstall the "airbrake" gem
73
- And I install cached gems
74
- And I configure my application to require the "capistrano" gem if necessary
75
- And I run "cap -T"
43
+ And I run `rails generate airbrake -k myapikey`
44
+ And I run `cap -T`
76
45
  Then I should see "airbrake:deploy"
77
46
 
78
47
  Scenario: Try to install when the airbrake plugin still exists
79
48
  When I install the "airbrake" plugin
80
49
  And I configure the Airbrake shim
81
50
  And I configure the notifier to use "myapikey" as an API key
82
- And I configure my application to require the "airbrake" gem
83
- And I run the airbrake generator with ""
51
+ And I run `rails generate airbrake`
84
52
  Then I should see "You must first remove the airbrake plugin. Please run: script/plugin remove airbrake"
85
53
 
86
54
  Scenario: Rescue an exception in a controller
87
55
  When I configure the Airbrake shim
88
- And I configure usage of Airbrake
56
+ And I run `rails generate airbrake -k myapikey`
89
57
  And I define a response for "TestController#index":
90
58
  """
91
59
  session[:value] = "test"
@@ -98,41 +66,36 @@ Feature: Install the Gem in a Rails application
98
66
 
99
67
  Scenario: The gem should not be considered a framework gem
100
68
  When I configure the Airbrake shim
101
- And I configure my application to require the "airbrake" gem
102
- And I run the airbrake generator with "-k myapikey"
103
- And I run "rake gems"
69
+ And I run `rails generate airbrake -k myapikey`
70
+ And I run `rake gems`
104
71
  Then I should see that "airbrake" is not considered a framework gem
105
72
 
106
73
  Scenario: The app uses Vlad instead of Capistrano
107
74
  When I configure the Airbrake shim
108
- And I configure my application to require the "airbrake" gem
109
- And I run "touch config/deploy.rb"
110
- And I run "rm Capfile"
111
- And I run the airbrake generator with "-k myapikey"
75
+ And I run `touch config/deploy.rb`
76
+ And I run `rm Capfile`
77
+ And I run `rails generate airbrake -k myapikey`
112
78
  Then "config/deploy.rb" should not contain "capistrano"
113
79
 
80
+ @wip
114
81
  Scenario: Support the Heroku addon in the generator
115
82
  When I configure the Airbrake shim
116
- And I configure the Heroku rake shim
117
- And I configure the Heroku gem shim with "myapikey"
118
- And I configure my application to require the "airbrake" gem
119
- And I run the airbrake generator with "--heroku"
120
- Then the command should have run successfully
121
- And I should receive a Airbrake notification
83
+ And I run `rails generate airbrake -k myapikey`
84
+ And I configure the Heroku shim with "myapikey"
85
+ And I successfully run `rails generate airbrake --heroku`
86
+ Then I should receive a Airbrake notification
122
87
  And I should see the Rails version
123
88
  And my Airbrake configuration should contain the following line:
124
89
  """
125
90
  config.api_key = ENV['HOPTOAD_API_KEY']
126
91
  """
127
92
 
93
+ @wip
128
94
  Scenario: Support the --app option for the Heroku addon in the generator
129
95
  When I configure the Airbrake shim
130
- And I configure the Heroku rake shim
131
- And I configure the Heroku gem shim with "myapikey" and multiple app support
132
- And I configure my application to require the "airbrake" gem
133
- And I run the airbrake generator with "--heroku -a myapp"
134
- Then the command should have run successfully
135
- And I should receive a Airbrake notification
96
+ And I configure the Heroku shim with "myapikey" and multiple app support
97
+ And I run `rails generate airbrake --heroku -a myapp`
98
+ Then I should receive a Airbrake notification
136
99
  And I should see the Rails version
137
100
  And my Airbrake configuration should contain the following line:
138
101
  """
@@ -141,54 +104,43 @@ Feature: Install the Gem in a Rails application
141
104
 
142
105
  Scenario: Filtering parameters in a controller
143
106
  When I configure the Airbrake shim
144
- And I configure usage of Airbrake
107
+ And I run `rails generate airbrake -k myapikey`
145
108
  When I configure the notifier to use the following configuration lines:
146
109
  """
147
110
  config.api_key = "myapikey"
148
111
  config.params_filters << "credit_card_number"
112
+ config.params_filters << "secret"
113
+ config.logger = Logger.new STDOUT
149
114
  """
150
115
  And I define a response for "TestController#index":
151
116
  """
117
+ session["secret"] = "blue42"
152
118
  params[:credit_card_number] = "red23"
153
119
  raise RuntimeError, "some message"
154
120
  """
155
121
  And I route "/test/index" to "test#index"
156
- And I perform a request to "http://example.com:123/test/index?param=value"
122
+ And I perform a request to "http://example.com:123/test/index?param=value" in the "production" environment
157
123
  Then I should receive a Airbrake notification
158
124
  Then I should not see "red23"
125
+ Then I should not see "blue42"
159
126
  And I should see "FILTERED"
160
127
 
161
- Scenario: Filtering session in a controller
128
+ Scenario: Filtering session and params based on Rails parameter filters
162
129
  When I configure the Airbrake shim
163
- And I configure usage of Airbrake
130
+ And I run `rails generate airbrake -k myapikey`
164
131
  When I configure the notifier to use the following configuration lines:
165
132
  """
166
- config.api_key = "myapikey"
167
- config.params_filters << "secret"
168
- """
169
- And I define a response for "TestController#index":
170
- """
171
- session["secret"] = "blue42"
172
- raise RuntimeError, "some message"
133
+ config.logger = Logger.new STDOUT
173
134
  """
174
- And I route "/test/index" to "test#index"
175
- And I perform a request to "http://example.com:123/test/index?param=value"
176
- Then I should receive a Airbrake notification
177
- Then I should not see "blue42"
178
- And I should see "FILTERED"
179
-
180
- Scenario: Filtering session and params based on Rails parameter filters
181
- When I configure the Airbrake shim
182
- And I configure usage of Airbrake
183
135
  And I configure the application to filter parameter "secret"
184
136
  And I define a response for "TestController#index":
185
137
  """
186
- params["secret"] = "red23"
138
+ params["secret"] = "red23"
187
139
  session["secret"] = "blue42"
188
140
  raise RuntimeError, "some message"
189
141
  """
190
142
  And I route "/test/index" to "test#index"
191
- And I perform a request to "http://example.com:123/test/index?param=value"
143
+ And I perform a request to "http://example.com:123/test/index" in the "production" environment
192
144
  Then I should receive a Airbrake notification
193
145
  And I should not see "red23"
194
146
  And I should not see "blue42"
@@ -196,7 +148,7 @@ Feature: Install the Gem in a Rails application
196
148
 
197
149
  Scenario: Notify airbrake within the controller
198
150
  When I configure the Airbrake shim
199
- And I configure usage of Airbrake
151
+ And I run `rails generate airbrake -k myapikey`
200
152
  And I define a response for "TestController#index":
201
153
  """
202
154
  session[:value] = "test"
@@ -204,32 +156,35 @@ Feature: Install the Gem in a Rails application
204
156
  render :nothing => true
205
157
  """
206
158
  And I route "/test/index" to "test#index"
207
- And I perform a request to "http://example.com:123/test/index?param=value"
159
+ And I perform a request to "http://example.com:123/test/index?param=value" in the "production" environment
208
160
  Then I should receive a Airbrake notification
209
161
  And I should see "test"
210
162
 
211
163
  Scenario: Reporting 404s should be disabled by default
212
164
  When I configure the Airbrake shim
213
- And I configure usage of Airbrake
214
- And I perform a request to "http://example.com:123/this/route/does/not/exist"
165
+ And I configure the notifier to use the following configuration lines:
166
+ """
167
+ config.api_key = "myapikey"
168
+ """
169
+ And I perform a request to "http://example.com:123/this/route/does/not/exist" in the "production" environment
215
170
  Then I should see "The page you were looking for doesn't exist."
216
171
  And I should not receive a Airbrake notification
217
172
 
218
173
  Scenario: Reporting 404s should work when configured properly
219
174
  When I configure the Airbrake shim
220
- And I configure usage of Airbrake
175
+ And I run `rails generate airbrake -k myapikey`
221
176
  When I configure the notifier to use the following configuration lines:
222
177
  """
223
178
  config.ignore_only = []
224
179
  """
225
- And I perform a request to "http://example.com:123/this/route/does/not/exist"
226
- Then I should see "The page you were looking for doesn't exist."
180
+ And I perform a request to "http://example.com:123/this/route/does/not/exist" in the "production" environment
181
+ Then I should see "The page you were looking for doesn't exist"
227
182
  And I should receive a Airbrake notification
228
183
 
184
+ @wip
229
185
  Scenario: reporting over SSL with utf8 check should work
230
- Given PENDING I fix this one
231
186
  When I configure the Airbrake shim
232
- And I configure usage of Airbrake
187
+ And I run `rails generate airbrake -k myapikey`
233
188
  When I configure the notifier to use the following configuration lines:
234
189
  """
235
190
  config.secure = true
@@ -244,29 +199,53 @@ Feature: Install the Gem in a Rails application
244
199
 
245
200
  Scenario: It should also send the user details
246
201
  When I configure the Airbrake shim
247
- And I configure usage of Airbrake
202
+ And I configure the notifier to use the following configuration lines:
203
+ """
204
+ config.api_key = "myapikey"
205
+ config.logger = Logger.new STDOUT
206
+ """
248
207
  And I define a response for "TestController#index":
249
208
  """
250
209
  raise RuntimeError, "some message"
251
210
  """
252
211
  And I route "/test/index" to "test#index"
253
212
  And I have set up authentication system in my app that uses "current_user"
254
- And I perform a request to "http://example.com:123/test/index"
213
+ And I perform a request to "http://example.com:123/test/index" in the "production" environment
255
214
  Then I should receive a Airbrake notification
256
215
  And the Airbrake notification should contain user details
257
216
  When I have set up authentication system in my app that uses "current_member"
258
- And I perform a request to "http://example.com:123/test/index"
217
+ And I perform a request to "http://example.com:123/test/index" in the "production" environment
259
218
  Then I should receive a Airbrake notification
260
219
  And the Airbrake notification should contain user details
261
220
 
262
221
  Scenario: It should log the notice when failure happens
263
222
  When Airbrake server is not responding
264
- And I configure usage of Airbrake
223
+ And I configure the notifier to use the following configuration lines:
224
+ """
225
+ config.api_key = "myapikey"
226
+ config.logger = Logger.new STDOUT
227
+ """
265
228
  And I define a response for "TestController#index":
266
229
  """
267
230
  raise RuntimeError, "some message"
268
231
  """
269
232
  And I route "/test/index" to "test#index"
270
- And I perform a request to "http://example.com:123/test/index?param=value"
233
+ And I perform a request to "http://example.com:123/test/index?param=value" in the "production" environment
271
234
  Then I should see "Notice details:"
272
235
  And I should see "some message"
236
+
237
+ Scenario: It should send the framework info
238
+ When I configure the Airbrake shim
239
+ And I configure the notifier to use the following configuration lines:
240
+ """
241
+ config.api_key = "myapikey"
242
+ config.logger = Logger.new STDOUT
243
+ """
244
+ And I define a response for "TestController#index":
245
+ """
246
+ raise RuntimeError, "some message"
247
+ """
248
+ And I route "/test/index" to "test#index"
249
+ And I perform a request to "http://example.com:123/test/index" in the "production" environment
250
+ Then I should receive a Airbrake notification
251
+ And the Airbrake notification should contain the framework information