honeybadger 1.16.7 → 2.0.0.beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (200) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +19 -0
  3. data/README.md +37 -16
  4. data/bin/honeybadger +5 -0
  5. data/lib/honeybadger.rb +167 -191
  6. data/lib/honeybadger/agent.rb +136 -0
  7. data/lib/honeybadger/backend.rb +26 -0
  8. data/lib/honeybadger/backend/base.rb +66 -0
  9. data/lib/honeybadger/backend/debug.rb +12 -0
  10. data/lib/honeybadger/backend/null.rb +16 -0
  11. data/lib/honeybadger/backend/server.rb +51 -0
  12. data/lib/honeybadger/backend/test.rb +24 -0
  13. data/lib/honeybadger/backtrace.rb +29 -24
  14. data/lib/honeybadger/cli.rb +367 -0
  15. data/lib/honeybadger/config.rb +333 -0
  16. data/lib/honeybadger/config/callbacks.rb +70 -0
  17. data/lib/honeybadger/config/defaults.rb +175 -0
  18. data/lib/honeybadger/config/env.rb +40 -0
  19. data/lib/honeybadger/config/yaml.rb +43 -0
  20. data/lib/honeybadger/const.rb +28 -0
  21. data/lib/honeybadger/init/rails.rb +84 -0
  22. data/lib/honeybadger/init/sinatra.rb +27 -0
  23. data/lib/honeybadger/logging.rb +133 -0
  24. data/lib/honeybadger/notice.rb +243 -280
  25. data/lib/honeybadger/plugin.rb +110 -0
  26. data/lib/honeybadger/plugins/delayed_job.rb +22 -0
  27. data/lib/honeybadger/{integrations → plugins}/delayed_job/plugin.rb +6 -7
  28. data/lib/honeybadger/{integrations → plugins}/local_variables.rb +7 -8
  29. data/lib/honeybadger/{integrations → plugins}/net_http.rb +10 -8
  30. data/lib/honeybadger/plugins/passenger.rb +24 -0
  31. data/lib/honeybadger/plugins/rails.rb +61 -0
  32. data/lib/honeybadger/plugins/sidekiq.rb +35 -0
  33. data/lib/honeybadger/{integrations → plugins}/thor.rb +9 -8
  34. data/lib/honeybadger/{integrations → plugins}/unicorn.rb +10 -9
  35. data/lib/honeybadger/rack/error_notifier.rb +44 -27
  36. data/lib/honeybadger/rack/metrics_reporter.rb +41 -0
  37. data/lib/honeybadger/rack/request_hash.rb +50 -0
  38. data/lib/honeybadger/rack/user_feedback.rb +15 -10
  39. data/lib/honeybadger/rack/user_informer.rb +14 -3
  40. data/lib/honeybadger/trace.rb +185 -0
  41. data/lib/honeybadger/util/http.rb +79 -0
  42. data/lib/honeybadger/util/request_sanitizer.rb +35 -0
  43. data/lib/honeybadger/util/sanitizer.rb +71 -0
  44. data/lib/honeybadger/util/stats.rb +31 -0
  45. data/lib/honeybadger/version.rb +4 -0
  46. data/lib/honeybadger/worker.rb +224 -0
  47. data/lib/honeybadger/worker/batch.rb +50 -0
  48. data/lib/honeybadger/worker/metered_queue.rb +80 -0
  49. data/lib/honeybadger/worker/metrics_collection.rb +61 -0
  50. data/lib/honeybadger/worker/metrics_collector.rb +96 -0
  51. data/{lib/honeybadger/capistrano.rb → vendor/capistrano-honeybadger/lib/capistrano/honeybadger.rb} +1 -3
  52. data/vendor/capistrano-honeybadger/lib/capistrano/tasks/deploy.cap +76 -0
  53. data/vendor/capistrano-honeybadger/lib/honeybadger/capistrano.rb +2 -0
  54. data/{lib → vendor/capistrano-honeybadger/lib}/honeybadger/capistrano/legacy.rb +16 -15
  55. data/vendor/thor/lib/thor.rb +484 -0
  56. data/vendor/thor/lib/thor/actions.rb +319 -0
  57. data/vendor/thor/lib/thor/actions/create_file.rb +103 -0
  58. data/vendor/thor/lib/thor/actions/create_link.rb +59 -0
  59. data/vendor/thor/lib/thor/actions/directory.rb +118 -0
  60. data/vendor/thor/lib/thor/actions/empty_directory.rb +135 -0
  61. data/vendor/thor/lib/thor/actions/file_manipulation.rb +316 -0
  62. data/vendor/thor/lib/thor/actions/inject_into_file.rb +107 -0
  63. data/vendor/thor/lib/thor/base.rb +656 -0
  64. data/vendor/thor/lib/thor/command.rb +133 -0
  65. data/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +77 -0
  66. data/vendor/thor/lib/thor/core_ext/io_binary_read.rb +10 -0
  67. data/vendor/thor/lib/thor/core_ext/ordered_hash.rb +98 -0
  68. data/vendor/thor/lib/thor/error.rb +32 -0
  69. data/vendor/thor/lib/thor/group.rb +281 -0
  70. data/vendor/thor/lib/thor/invocation.rb +178 -0
  71. data/vendor/thor/lib/thor/line_editor.rb +17 -0
  72. data/vendor/thor/lib/thor/line_editor/basic.rb +35 -0
  73. data/vendor/thor/lib/thor/line_editor/readline.rb +88 -0
  74. data/vendor/thor/lib/thor/parser.rb +4 -0
  75. data/vendor/thor/lib/thor/parser/argument.rb +73 -0
  76. data/vendor/thor/lib/thor/parser/arguments.rb +175 -0
  77. data/vendor/thor/lib/thor/parser/option.rb +125 -0
  78. data/vendor/thor/lib/thor/parser/options.rb +218 -0
  79. data/vendor/thor/lib/thor/rake_compat.rb +71 -0
  80. data/vendor/thor/lib/thor/runner.rb +322 -0
  81. data/vendor/thor/lib/thor/shell.rb +81 -0
  82. data/vendor/thor/lib/thor/shell/basic.rb +421 -0
  83. data/vendor/thor/lib/thor/shell/color.rb +149 -0
  84. data/vendor/thor/lib/thor/shell/html.rb +126 -0
  85. data/vendor/thor/lib/thor/util.rb +267 -0
  86. data/vendor/thor/lib/thor/version.rb +3 -0
  87. metadata +97 -305
  88. data/Appraisals +0 -95
  89. data/CHANGELOG.md +0 -422
  90. data/Gemfile +0 -8
  91. data/Gemfile.lock +0 -136
  92. data/Guardfile +0 -5
  93. data/MIT-LICENSE +0 -32
  94. data/Rakefile +0 -159
  95. data/features/metal.feature +0 -20
  96. data/features/rack.feature +0 -55
  97. data/features/rails.feature +0 -343
  98. data/features/rails3.x.feature +0 -26
  99. data/features/rake.feature +0 -25
  100. data/features/sinatra.feature +0 -27
  101. data/features/standalone.feature +0 -73
  102. data/features/step_definitions/metal_steps.rb +0 -24
  103. data/features/step_definitions/rack_steps.rb +0 -18
  104. data/features/step_definitions/rails_steps.rb +0 -270
  105. data/features/step_definitions/rake_steps.rb +0 -17
  106. data/features/step_definitions/standalone_steps.rb +0 -12
  107. data/features/step_definitions/thor_steps.rb +0 -4
  108. data/features/support/env.rb +0 -22
  109. data/features/support/honeybadger_failure_shim.rb.template +0 -5
  110. data/features/support/honeybadger_shim.rb.template +0 -6
  111. data/features/support/rails.rb +0 -202
  112. data/features/support/rake/Rakefile +0 -68
  113. data/features/support/test.thor +0 -22
  114. data/features/thor.feature +0 -5
  115. data/gemfiles/binding_of_caller.gemfile +0 -13
  116. data/gemfiles/delayed_job.gemfile +0 -13
  117. data/gemfiles/rack.gemfile +0 -13
  118. data/gemfiles/rails.gemfile +0 -16
  119. data/gemfiles/rails2.3.gemfile +0 -15
  120. data/gemfiles/rails3.0.gemfile +0 -16
  121. data/gemfiles/rails3.1.gemfile +0 -16
  122. data/gemfiles/rails3.2.gemfile +0 -16
  123. data/gemfiles/rails4.0.gemfile +0 -16
  124. data/gemfiles/rails4.1.gemfile +0 -16
  125. data/gemfiles/rake.gemfile +0 -13
  126. data/gemfiles/sinatra.gemfile +0 -13
  127. data/gemfiles/standalone.gemfile +0 -12
  128. data/gemfiles/thor.gemfile +0 -13
  129. data/generators/honeybadger/honeybadger_generator.rb +0 -95
  130. data/generators/honeybadger/lib/insert_commands.rb +0 -34
  131. data/generators/honeybadger/lib/rake_commands.rb +0 -24
  132. data/generators/honeybadger/templates/capistrano_hook.rb +0 -6
  133. data/generators/honeybadger/templates/honeybadger_tasks.rake +0 -25
  134. data/generators/honeybadger/templates/initializer.rb +0 -6
  135. data/honeybadger.gemspec +0 -174
  136. data/lib/honeybadger/array.rb +0 -53
  137. data/lib/honeybadger/capistrano/tasks.rake +0 -73
  138. data/lib/honeybadger/configuration.rb +0 -397
  139. data/lib/honeybadger/dependency.rb +0 -65
  140. data/lib/honeybadger/integrations.rb +0 -9
  141. data/lib/honeybadger/integrations/delayed_job.rb +0 -20
  142. data/lib/honeybadger/integrations/passenger.rb +0 -18
  143. data/lib/honeybadger/integrations/sidekiq.rb +0 -37
  144. data/lib/honeybadger/monitor.rb +0 -17
  145. data/lib/honeybadger/monitor/railtie.rb +0 -53
  146. data/lib/honeybadger/monitor/sender.rb +0 -44
  147. data/lib/honeybadger/monitor/trace.rb +0 -187
  148. data/lib/honeybadger/monitor/worker.rb +0 -169
  149. data/lib/honeybadger/payload.rb +0 -101
  150. data/lib/honeybadger/rack.rb +0 -12
  151. data/lib/honeybadger/rails.rb +0 -45
  152. data/lib/honeybadger/rails/action_controller_catcher.rb +0 -30
  153. data/lib/honeybadger/rails/controller_methods.rb +0 -78
  154. data/lib/honeybadger/rails/middleware/exceptions_catcher.rb +0 -29
  155. data/lib/honeybadger/rails3_tasks.rb +0 -94
  156. data/lib/honeybadger/railtie.rb +0 -52
  157. data/lib/honeybadger/rake_handler.rb +0 -66
  158. data/lib/honeybadger/sender.rb +0 -185
  159. data/lib/honeybadger/shared_tasks.rb +0 -56
  160. data/lib/honeybadger/stats.rb +0 -29
  161. data/lib/honeybadger/tasks.rb +0 -95
  162. data/lib/honeybadger/user_feedback.rb +0 -8
  163. data/lib/honeybadger/user_informer.rb +0 -8
  164. data/lib/honeybadger_tasks.rb +0 -69
  165. data/lib/rails/generators/honeybadger/honeybadger_generator.rb +0 -99
  166. data/rails/init.rb +0 -1
  167. data/resources/README.md +0 -34
  168. data/script/integration_test.rb +0 -38
  169. data/spec/allocation_stats.rb +0 -32
  170. data/spec/honeybadger/backtrace_spec.rb +0 -242
  171. data/spec/honeybadger/capistrano_spec.rb +0 -36
  172. data/spec/honeybadger/configuration_spec.rb +0 -328
  173. data/spec/honeybadger/dependency_spec.rb +0 -134
  174. data/spec/honeybadger/integrations/delayed_job_spec.rb +0 -82
  175. data/spec/honeybadger/integrations/local_variables_spec.rb +0 -60
  176. data/spec/honeybadger/integrations/net_http_spec.rb +0 -29
  177. data/spec/honeybadger/integrations/passenger_spec.rb +0 -29
  178. data/spec/honeybadger/integrations/sidekiq_spec.rb +0 -60
  179. data/spec/honeybadger/integrations/thor_spec.rb +0 -32
  180. data/spec/honeybadger/integrations/unicorn_spec.rb +0 -40
  181. data/spec/honeybadger/logger_spec.rb +0 -79
  182. data/spec/honeybadger/monitor/trace_spec.rb +0 -65
  183. data/spec/honeybadger/monitor/worker_spec.rb +0 -274
  184. data/spec/honeybadger/notice_spec.rb +0 -669
  185. data/spec/honeybadger/notifier_spec.rb +0 -328
  186. data/spec/honeybadger/payload_spec.rb +0 -162
  187. data/spec/honeybadger/rack_spec.rb +0 -85
  188. data/spec/honeybadger/rails/action_controller_spec.rb +0 -328
  189. data/spec/honeybadger/rails_spec.rb +0 -37
  190. data/spec/honeybadger/sender_spec.rb +0 -317
  191. data/spec/honeybadger/stats_spec.rb +0 -57
  192. data/spec/honeybadger/user_feedback_spec.rb +0 -80
  193. data/spec/honeybadger/user_informer_spec.rb +0 -30
  194. data/spec/honeybadger_tasks_spec.rb +0 -171
  195. data/spec/spec_helper.rb +0 -24
  196. data/spec/support/array_including.rb +0 -31
  197. data/spec/support/backtraced_exception.rb +0 -9
  198. data/spec/support/collected_sender.rb +0 -12
  199. data/spec/support/defines_constants.rb +0 -18
  200. data/spec/support/helpers.rb +0 -101
data/Guardfile DELETED
@@ -1,5 +0,0 @@
1
- guard :rspec, :cli => '--format Fuubar --fail-fast', :all_after_pass => false do
2
- watch(%r{^spec/.+_spec\.rb$})
3
- watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
4
- watch('spec/spec_helper.rb') { "spec" }
5
- end
data/MIT-LICENSE DELETED
@@ -1,32 +0,0 @@
1
- Copyright (c) 2012-2013, Honeybadger Industries LLC
2
- Portions Copyright (c) 2012 Noah Lorang
3
- Portions Copyright (c) 2007-2012, Exceptional DBA Airbrake.io
4
- Portions Copyright (c) 2009 Brenton Fletcher (http://i.bloople.net i@bloople.net)
5
- Portions Copyright (c) 2014 Charlie Somerville
6
-
7
- The original version of the Honeybadger gem was based on the
8
- MIT-licensed Airbrake gem. All code contained herein that is
9
- copyright Exceptional DBA Airbrake.io was available under the
10
- MIT license (listed below) on or before November 6, 2012.
11
-
12
- Permission is hereby granted, free of charge, to any person
13
- obtaining a copy of this software and associated documentation
14
- files (the "Software"), to deal in the Software without
15
- restriction, including without limitation the rights to use,
16
- copy, modify, merge, publish, distribute, sublicense, and/or sell
17
- copies of the Software, and to permit persons to whom the
18
- Software is furnished to do so, subject to the following
19
- conditions:
20
-
21
- The above copyright notice and this permission notice shall be
22
- included in all copies or substantial portions of the Software.
23
-
24
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
26
- OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
28
- HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
29
- WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
30
- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
31
- OTHER DEALINGS IN THE SOFTWARE.
32
-
data/Rakefile DELETED
@@ -1,159 +0,0 @@
1
- require 'rubygems'
2
- require 'bundler/setup'
3
- require 'appraisal'
4
- require 'date'
5
- require 'json'
6
-
7
- begin
8
- require 'cucumber/rake/task'
9
- rescue LoadError
10
- $stderr.puts "Please install cucumber: `gem install cucumber`"
11
- exit 1
12
- end
13
-
14
- #############################################################################
15
- #
16
- # Helper methods
17
- #
18
- #############################################################################
19
-
20
- def name
21
- @name ||= Dir['*.gemspec'].first.split('.').first
22
- end
23
-
24
- def version
25
- line = File.read("lib/#{name}.rb")[/^\s*VERSION\s*=\s*.*/]
26
- line.match(/.*VERSION\s*=\s*['"](.*)['"]/)[1]
27
- end
28
-
29
- def date
30
- Date.today.to_s
31
- end
32
-
33
- def rubyforge_project
34
- name
35
- end
36
-
37
- def gemspec_file
38
- "#{name}.gemspec"
39
- end
40
-
41
- def gem_file
42
- "#{name}-#{version}.gem"
43
- end
44
-
45
- def replace_header(head, header_name)
46
- head.sub!(/(\.#{header_name}\s*= ').*'/) { "#{$1}#{send(header_name)}'"}
47
- end
48
-
49
- #############################################################################
50
- #
51
- # Standard tasks
52
- #
53
- #############################################################################
54
-
55
- require 'rspec/core/rake_task'
56
- RSpec::Core::RakeTask.new(:spec)
57
- task :default => :spec
58
- task :test => :spec
59
-
60
- Cucumber::Rake::Task.new(:cucumber) do |t|
61
- t.fork = true
62
- t.cucumber_opts = ['--format', 'progress', '--tags', '~@pending']
63
-
64
- unless ENV['BUNDLE_GEMFILE'] =~ /rails[^2]/
65
- t.cucumber_opts << '--tags ~@rails_3'
66
- end
67
-
68
- if ENV['BUNDLE_GEMFILE'] =~ /rails3/
69
- t.cucumber_opts << 'features/rails3.x.feature'
70
- end
71
-
72
- case ENV['BUNDLE_GEMFILE']
73
- when /rails/
74
- t.cucumber_opts << 'features/rails.feature features/metal.feature'
75
- when /rack/
76
- t.cucumber_opts << 'features/rack.feature'
77
- when /rake/
78
- t.cucumber_opts << 'features/rake.feature'
79
- when /thor/
80
- t.cucumber_opts << 'features/thor.feature'
81
- when /sinatra/
82
- t.cucumber_opts << 'features/sinatra.feature'
83
- else
84
- t.cucumber_opts << 'features/standalone.feature'
85
- end unless ENV['FEATURE']
86
- end
87
-
88
- desc "Open an irb session preloaded with this library"
89
- task :console do
90
- sh "irb -rubygems -r ./lib/#{name}.rb"
91
- end
92
-
93
- #############################################################################
94
- #
95
- # Packaging tasks
96
- #
97
- #############################################################################
98
-
99
- desc "Create tag v#{version} and build and push #{gem_file} to Rubygems"
100
- task :release => :build do
101
- unless `git branch` =~ /^\* master$/
102
- puts "You must be on the master branch to release!"
103
- exit!
104
- end
105
- sh "git commit --allow-empty -a -e -m 'Release #{version}'"
106
- sh "git tag v#{version}"
107
- sh "git push origin master"
108
- sh "git push origin v#{version}"
109
- sh "gem push pkg/#{name}-#{version}.gem"
110
- end
111
-
112
- desc "Build #{gem_file} into the pkg directory"
113
- task :build => :gemspec do
114
- sh "mkdir -p pkg"
115
- sh "gem build #{gemspec_file}"
116
- sh "mv #{gem_file} pkg"
117
- end
118
-
119
- desc "Generate #{gemspec_file}"
120
- task :gemspec => :validate do
121
- # read spec file and split out manifest section
122
- spec = File.read(gemspec_file)
123
- head, manifest, tail = spec.split(" # = MANIFEST =\n")
124
-
125
- # replace name version and date
126
- replace_header(head, :name)
127
- replace_header(head, :version)
128
- replace_header(head, :date)
129
- #comment this out if your rubyforge_project has a different name
130
- replace_header(head, :rubyforge_project)
131
-
132
- # determine file list from git ls-files
133
- files = `git ls-files`.
134
- split("\n").
135
- sort.
136
- reject { |file| file =~ /^\./ }.
137
- reject { |file| file =~ /^(rdoc|pkg)/ }.
138
- map { |file| " #{file}" }.
139
- join("\n")
140
-
141
- # piece file back together and write
142
- manifest = " s.files = %w[\n#{files}\n ]\n"
143
- spec = [head, manifest, tail].join(" # = MANIFEST =\n")
144
- File.open(gemspec_file, 'w') { |io| io.write(spec) }
145
- puts "Updated #{gemspec_file}"
146
- end
147
-
148
- desc "Validate #{gemspec_file}"
149
- task :validate do
150
- libfiles = Dir['lib/*'] - ["lib/#{name}.rb", "lib/#{name}_tasks.rb", "lib/#{name}", "lib/rails"]
151
- unless libfiles.empty?
152
- puts "Directory `lib` should only contain `#{name}.rb` and `#{name}_tasks.rb` files, and `#{name}` and lib/rails dir."
153
- exit!
154
- end
155
- unless Dir['VERSION*'].empty?
156
- puts "A `VERSION` file at root level violates Gem best practices."
157
- exit!
158
- end
159
- end
@@ -1,20 +0,0 @@
1
- Feature: Rescue errors in Rails middleware
2
-
3
- Background:
4
- Given I generate a new Rails application
5
- And I configure the Honeybadger shim
6
- And I configure Honeybadger with:
7
- """
8
- config.api_key = 'myapikey'
9
- config.logger = Logger.new(STDOUT)
10
- """
11
-
12
- Scenario: Rescue an exception in the dispatcher
13
- When I define a Metal endpoint called "Exploder":
14
- """
15
- def self.call(env)
16
- raise "Explode"
17
- end
18
- """
19
- When I perform a request to "http://example.com:123/metal/index?param=value"
20
- Then I should receive a Honeybadger notification
@@ -1,55 +0,0 @@
1
- Feature: Use the notifier in a plain Rack app
2
-
3
- Scenario: Rescue and exception in a Rack app
4
- Given the following Rack app:
5
- """
6
- require 'rack'
7
- require 'honeybadger'
8
-
9
- Honeybadger.configure do |config|
10
- config.api_key = 'my_api_key'
11
- config.logger = Logger.new STDOUT
12
- end
13
-
14
- app = Rack::Builder.app do
15
- use Honeybadger::Rack
16
- run lambda { |env| raise "Rack down" }
17
- end
18
- """
19
- When I perform a Rack request to "http://example.com:123/test/index?param=value"
20
- Then I should receive a Honeybadger notification
21
-
22
- Scenario: Ignore user agents
23
- Given the following Rack app:
24
- """
25
- require 'rack'
26
- require 'honeybadger'
27
-
28
- Honeybadger.configure do |config|
29
- config.api_key = 'my_api_key'
30
- config.ignore_user_agent << /ignore/
31
- config.logger = Logger.new STDOUT
32
- end
33
-
34
- class Mock
35
- class AppendUserAgent
36
- def initialize(app)
37
- @app = app
38
- end
39
-
40
- def call(env)
41
- env["HTTP_USER_AGENT"] = "ignore"
42
- @app.call(env)
43
- end
44
- end
45
- end
46
-
47
- app = Rack::Builder.app do
48
- use Honeybadger::Rack
49
- use Mock::AppendUserAgent
50
- run lambda { |env| raise "Rack down" }
51
- end
52
- """
53
- When I perform a Rack request to "http://example.com:123/test/index?param=value"
54
- Then the output should not contain "** [Honeybadger] Response from Honeybadger:"
55
-
@@ -1,343 +0,0 @@
1
- Feature: Install the Gem in a Rails application
2
-
3
- Background:
4
- Given I generate a new Rails application
5
- And I configure the Honeybadger shim
6
-
7
- Scenario: Use the gem without vendoring the gem in a Rails application
8
- When I run the honeybadger generator with "-k myapikey"
9
- Then I should receive a Honeybadger notification
10
- And I should see the Rails version
11
-
12
- Scenario: Configure the notifier by hand
13
- When I configure my application to require Honeybadger
14
- And I configure the notifier to use "myapikey" as an API key
15
- And I run the honeybadger generator with ""
16
- Then I should receive a Honeybadger notification
17
-
18
- Scenario: Configuration within initializer isn't overridden by Railtie
19
- When I configure my application to require Honeybadger
20
- And I run the honeybadger generator with "-k myapikey"
21
- And I configure Honeybadger with:
22
- """
23
- config.api_key = "myapikey"
24
- config.project_root = "argle/bargle"
25
- """
26
- And I run `rake honeybadger:test`
27
- Then the output should contain "argle/bargle"
28
-
29
- Scenario: Try to install without an api key
30
- When I configure my application to require Honeybadger
31
- And I run the honeybadger generator with ""
32
- Then the output should contain "Must pass --api-key or --heroku or create config/initializers/honeybadger.rb"
33
-
34
- Scenario: Configure and deploy with Capistrano
35
- When I install capistrano
36
- And I configure my application to require Honeybadger
37
- And I run the honeybadger generator with "-k myapikey"
38
- And I run `cap -T`
39
- Then the output should contain "honeybadger:deploy"
40
-
41
- Scenario: Try to install when the honeybadger plugin still exists
42
- When I install the "honeybadger" plugin
43
- And I configure the notifier to use "myapikey" as an API key
44
- And I configure my application to require Honeybadger
45
- And I run the honeybadger generator with ""
46
- Then the output should contain "You must first remove the honeybadger plugin. Please run: script/plugin remove honeybadger"
47
-
48
- @rails_3
49
- Scenario: Running the test task with config.force_ssl enabled
50
- When I configure Rails with:
51
- """
52
- config.force_ssl = true
53
- """
54
- And I configure the notifier to use "myapikey" as an API key
55
- And I configure my application to require Honeybadger
56
- And I run `rake honeybadger:test`
57
- Then I should receive a Honeybadger notification
58
-
59
- @rails_3
60
- Scenario: Running the test task with better_errors installed
61
- When I configure Rails with:
62
- """
63
- require 'better_errors'
64
- """
65
- And I configure the notifier to use "myapikey" as an API key
66
- And I configure my application to require Honeybadger
67
- And I run `rake honeybadger:test`
68
- Then the output should contain "Better Errors detected"
69
- And I should receive a Honeybadger notification
70
-
71
- @rails_3
72
- Scenario: Running the test task with rack-mini-profiler installed
73
- When I configure Rails with:
74
- """
75
- require 'rack-mini-profiler'
76
- """
77
- And I configure the notifier to use "myapikey" as an API key
78
- And I configure my application to require Honeybadger
79
- And I run `rake honeybadger:test`
80
- Then the output should not contain "rake aborted"
81
- And I should receive a Honeybadger notification
82
-
83
- Scenario: Rescue an exception in a controller
84
- When I configure my application to require Honeybadger
85
- And I configure Honeybadger with:
86
- """
87
- config.api_key = 'myapikey'
88
- config.logger = Logger.new(STDOUT)
89
- """
90
- And I define a response for "TestController#index":
91
- """
92
- session[:value] = "test"
93
- raise RuntimeError, "some message"
94
- """
95
- And I route "/test/index" to "test#index"
96
- And I perform a request to "http://example.com:123/test/index?param=value"
97
- Then I should receive a Honeybadger notification
98
-
99
- Scenario: Rescue an exception in a metal controller
100
- When I configure my application to require Honeybadger
101
- And I configure Honeybadger with:
102
- """
103
- config.api_key = 'myapikey'
104
- config.logger = Logger.new(STDOUT)
105
- """
106
- And I define a metal response for "TestController#index":
107
- """
108
- raise RuntimeError, "some message"
109
- """
110
- And I route "/test/index" to "test#index"
111
- And I perform a request to "http://example.com:123/test/index?param=value"
112
- Then I should receive a Honeybadger notification
113
-
114
- Scenario: Output when user informer is enabled
115
- When I configure my application to require Honeybadger
116
- And I configure Honeybadger with:
117
- """
118
- config.api_key = 'myapikey'
119
- config.logger = Logger.new(STDOUT)
120
- """
121
- And I define a response for "TestController#index":
122
- """
123
- session[:value] = "test"
124
- raise RuntimeError, "some message"
125
- """
126
- And I configure the user informer
127
- And I route "/test/index" to "test#index"
128
- And I perform a request to "http://example.com:123/test/index?param=value"
129
- Then the output should contain "Honeybadger Error 123456789"
130
- And the output should not contain "<!-- HONEYBADGER ERROR -->"
131
-
132
- Scenario: Output when user feedback is enabled
133
- When I configure my application to require Honeybadger
134
- And I configure Honeybadger with:
135
- """
136
- config.api_key = 'myapikey'
137
- config.logger = Logger.new(STDOUT)
138
- """
139
- And I define a response for "TestController#index":
140
- """
141
- session[:value] = "test"
142
- raise RuntimeError, "some message"
143
- """
144
- And I configure the user feedback form
145
- And I route "/test/index" to "test#index"
146
- And I perform a request to "http://example.com:123/test/index?param=value"
147
- Then the output should contain "honeybadger_feedback_token"
148
- And the output should not contain "<!-- HONEYBADGER FEEDBACK -->"
149
-
150
- Scenario: Log output in production environments
151
- When I configure my application to require Honeybadger
152
- And I configure Honeybadger with:
153
- """
154
- config.api_key = 'myapikey'
155
- config.logger = Logger.new(STDOUT)
156
- config.logger.level = Logger::INFO
157
- """
158
- And I define a response for "TestController#index":
159
- """
160
- raise RuntimeError, "some message"
161
- """
162
- And I route "/test/index" to "test#index"
163
- And I perform a request to "http://example.com:123/test/index?param=value"
164
- Then the output should match /\[Honeybadger\] Notifier (?:\S+) ready to catch errors/
165
- Then the output should not contain "[Honeybadger] Success"
166
- Then the output should not contain "[Honeybadger] Environment Info"
167
- Then the output should not contain "[Honeybadger] Response from Honeybadger"
168
- Then the output should not contain "[Honeybadger] Notice"
169
-
170
- Scenario: Failure to notify Honeybadger in production environments
171
- When I configure the Honeybadger failure shim
172
- And I configure my application to require Honeybadger
173
- And I configure Honeybadger with:
174
- """
175
- config.api_key = 'myapikey'
176
- config.logger = Logger.new(STDOUT)
177
- config.logger.level = Logger::INFO
178
- """
179
- And I define a response for "TestController#index":
180
- """
181
- raise RuntimeError, "some message"
182
- """
183
- And I route "/test/index" to "test#index"
184
- And I perform a request to "http://example.com:123/test/index?param=value"
185
- Then the output should contain "[Honeybadger] Failure"
186
- Then the output should not contain "Honeybadger::Sender#send_to_honeybadger"
187
-
188
- Scenario: The app uses Vlad instead of Capistrano
189
- When I configure my application to require Honeybadger
190
- And I run `touch config/deploy.rb`
191
- And I run `rm Capfile`
192
- And I run the honeybadger generator with "-k myapikey"
193
- Then the file "config/deploy.rb" should not contain "capistrano"
194
-
195
- Scenario: Support the Heroku addon in the generator
196
- When I configure the Heroku gem shim with "myapikey"
197
- And I configure my application to require Honeybadger
198
- And I run the honeybadger generator with "--heroku"
199
- Then I should receive a Honeybadger notification
200
- And I should see the Rails version
201
- And my Honeybadger configuration should contain the following line:
202
- """
203
- config.api_key = ENV['HONEYBADGER_API_KEY']
204
- """
205
-
206
- Scenario: Support the --app option for the Heroku addon in the generator
207
- When I configure the Heroku gem shim with "myapikey" and multiple app support
208
- And I configure my application to require Honeybadger
209
- And I run the honeybadger generator with "--heroku -a myapp"
210
- Then I should receive a Honeybadger notification
211
- And I should see the Rails version
212
- And my Honeybadger configuration should contain the following line:
213
- """
214
- config.api_key = ENV['HONEYBADGER_API_KEY']
215
- """
216
-
217
- Scenario: Filtering parameters in a controller
218
- When I configure my application to require Honeybadger
219
- And I configure Honeybadger with:
220
- """
221
- config.api_key = "myapikey"
222
- config.logger = Logger.new(STDOUT)
223
- config.params_filters << "credit_card_number"
224
- config.params_filters << "secret"
225
- config.debug = true
226
- """
227
- And I define a response for "TestController#index":
228
- """
229
- params[:credit_card_number] = "red23"
230
- raise RuntimeError, "some message"
231
- """
232
- And I route "/test/index" to "test#index"
233
- And I perform a request to "http://example.com:123/test/index?param=value&secret=blue42"
234
- Then I should receive a Honeybadger notification
235
- And the request should not contain "red23"
236
- And the request should not contain "blue42"
237
- And the request params should contain "FILTERED"
238
-
239
- Scenario: Filtering session in a controller
240
- When I configure my application to require Honeybadger
241
- And I configure Honeybadger with:
242
- """
243
- config.api_key = "myapikey"
244
- config.logger = Logger.new(STDOUT)
245
- config.params_filters << "secret"
246
- config.debug = true
247
- """
248
- And I define a response for "TestController#index":
249
- """
250
- session["secret"] = "blue42"
251
- raise RuntimeError, "some message"
252
- """
253
- And I route "/test/index" to "test#index"
254
- And I perform a request to "http://example.com:123/test/index?param=value"
255
- Then I should receive a Honeybadger notification
256
- And the request should not contain "blue42"
257
- And the request session should contain "FILTERED"
258
-
259
- Scenario: Filtering session and params based on Rails parameter filters
260
- When I configure my application to require Honeybadger
261
- And I configure Honeybadger with:
262
- """
263
- config.api_key = 'myapikey'
264
- config.logger = Logger.new(STDOUT)
265
- config.debug = true
266
- """
267
- And I configure the application to filter parameter "secret"
268
- And I define a response for "TestController#index":
269
- """
270
- params["secret"] = "red23"
271
- session["secret"] = "blue42"
272
- raise RuntimeError, "some message"
273
- """
274
- And I route "/test/index" to "test#index"
275
- And I perform a request to "http://example.com:123/test/index?param=value"
276
- Then I should receive a Honeybadger notification
277
- And the request should not contain "red23"
278
- And the request should not contain "blue42"
279
- And the request session should contain "FILTERED"
280
- And the request params should contain "FILTERED"
281
-
282
- Scenario: Notify honeybadger within the controller
283
- When I configure my application to require Honeybadger
284
- And I configure Honeybadger with:
285
- """
286
- config.api_key = 'myapikey'
287
- config.logger = Logger.new(STDOUT)
288
- """
289
- And I define a response for "TestController#index":
290
- """
291
- session[:value] = "test"
292
- notify_honeybadger(RuntimeError.new("some message"))
293
- render :nothing => true
294
- """
295
- And I route "/test/index" to "test#index"
296
- And I perform a request to "http://example.com:123/test/index?param=value"
297
- Then I should receive a Honeybadger notification
298
-
299
- Scenario: Reporting 404s
300
- When I configure my application to require Honeybadger
301
- And I configure Honeybadger with:
302
- """
303
- config.api_key = 'myapikey'
304
- config.logger = Logger.new(STDOUT)
305
- config.ignore_only = []
306
- """
307
- And I perform a request to "http://example.com:123/this/route/does/not/exist"
308
- Then the output should contain "The page you were looking for doesn't exist."
309
- And I should receive a Honeybadger notification
310
-
311
- Scenario: Asynchronous delivery
312
- When I configure my application to require Honeybadger
313
- And I configure Honeybadger with:
314
- """
315
- config.api_key = 'myapikey'
316
- config.logger = Logger.new(STDOUT)
317
- config.async do |notice|
318
- handler = Thread.new do
319
- notice.deliver
320
- end
321
- handler.join
322
- end
323
- """
324
- And I define a response for "TestController#index":
325
- """
326
- raise RuntimeError, "some message"
327
- """
328
- And I route "/test/index" to "test#index"
329
- And I perform a request to "http://example.com:123/test/index?param=value"
330
- Then I should receive a Honeybadger notification
331
-
332
- Scenario: Asynchronous delivery in generator
333
- When I configure my application to require Honeybadger
334
- And I configure Honeybadger with:
335
- """
336
- config.api_key = 'myapikey'
337
- config.async do |notice|
338
- Thread.new { notice.deliver }
339
- end
340
- """
341
- And I run the honeybadger generator with ""
342
- Then the output should contain "Temporarily disabling asynchronous delivery"
343
- And I should receive a Honeybadger notification