bugsnag-maglev- 2.8.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +7 -0
  2. data/.document +5 -0
  3. data/.gitignore +52 -0
  4. data/.rspec +3 -0
  5. data/.travis.yml +15 -0
  6. data/CHANGELOG.md +425 -0
  7. data/CONTRIBUTING.md +43 -0
  8. data/Gemfile +2 -0
  9. data/LICENSE.txt +20 -0
  10. data/README.md +804 -0
  11. data/Rakefile +29 -0
  12. data/VERSION +1 -0
  13. data/bugsnag.gemspec +32 -0
  14. data/lib/bugsnag.rb +129 -0
  15. data/lib/bugsnag/capistrano.rb +7 -0
  16. data/lib/bugsnag/capistrano2.rb +32 -0
  17. data/lib/bugsnag/configuration.rb +129 -0
  18. data/lib/bugsnag/delay/resque.rb +21 -0
  19. data/lib/bugsnag/delayed_job.rb +57 -0
  20. data/lib/bugsnag/delivery.rb +18 -0
  21. data/lib/bugsnag/delivery/synchronous.rb +51 -0
  22. data/lib/bugsnag/delivery/thread_queue.rb +53 -0
  23. data/lib/bugsnag/deploy.rb +35 -0
  24. data/lib/bugsnag/helpers.rb +127 -0
  25. data/lib/bugsnag/mailman.rb +28 -0
  26. data/lib/bugsnag/meta_data.rb +7 -0
  27. data/lib/bugsnag/middleware/callbacks.rb +19 -0
  28. data/lib/bugsnag/middleware/mailman.rb +13 -0
  29. data/lib/bugsnag/middleware/rack_request.rb +72 -0
  30. data/lib/bugsnag/middleware/rails2_request.rb +52 -0
  31. data/lib/bugsnag/middleware/rails3_request.rb +42 -0
  32. data/lib/bugsnag/middleware/rake.rb +23 -0
  33. data/lib/bugsnag/middleware/sidekiq.rb +13 -0
  34. data/lib/bugsnag/middleware/warden_user.rb +39 -0
  35. data/lib/bugsnag/middleware_stack.rb +98 -0
  36. data/lib/bugsnag/notification.rb +452 -0
  37. data/lib/bugsnag/rack.rb +53 -0
  38. data/lib/bugsnag/rails.rb +66 -0
  39. data/lib/bugsnag/rails/action_controller_rescue.rb +62 -0
  40. data/lib/bugsnag/rails/active_record_rescue.rb +20 -0
  41. data/lib/bugsnag/rails/controller_methods.rb +44 -0
  42. data/lib/bugsnag/railtie.rb +78 -0
  43. data/lib/bugsnag/rake.rb +25 -0
  44. data/lib/bugsnag/resque.rb +40 -0
  45. data/lib/bugsnag/sidekiq.rb +38 -0
  46. data/lib/bugsnag/tasks.rb +3 -0
  47. data/lib/bugsnag/tasks/bugsnag.cap +48 -0
  48. data/lib/bugsnag/tasks/bugsnag.rake +89 -0
  49. data/lib/bugsnag/version.rb +3 -0
  50. data/lib/generators/bugsnag/bugsnag_generator.rb +24 -0
  51. data/rails/init.rb +3 -0
  52. data/spec/code_spec.rb +86 -0
  53. data/spec/fixtures/crashes/end_of_file.rb +9 -0
  54. data/spec/fixtures/crashes/short_file.rb +1 -0
  55. data/spec/fixtures/crashes/start_of_file.rb +9 -0
  56. data/spec/fixtures/middleware/internal_info_setter.rb +11 -0
  57. data/spec/fixtures/middleware/public_info_setter.rb +11 -0
  58. data/spec/fixtures/tasks/Rakefile +15 -0
  59. data/spec/helper_spec.rb +144 -0
  60. data/spec/integration_spec.rb +110 -0
  61. data/spec/middleware_spec.rb +181 -0
  62. data/spec/notification_spec.rb +822 -0
  63. data/spec/rack_spec.rb +56 -0
  64. data/spec/spec_helper.rb +53 -0
  65. metadata +198 -0
@@ -0,0 +1,56 @@
1
+ require 'spec_helper'
2
+
3
+ describe Bugsnag::Rack do
4
+ it "calls the upstream rack app with the environment" do
5
+ rack_env = {"key" => "value"}
6
+ app = lambda { |env| ['response', {}, env] }
7
+ rack_stack = Bugsnag::Rack.new(app)
8
+
9
+ response = rack_stack.call(rack_env)
10
+
11
+ expect(response).to eq(['response', {}, rack_env])
12
+ end
13
+
14
+ context "when an exception is raised in rack middleware" do
15
+ # Build a fake crashing rack app
16
+ exception = BugsnagTestException.new("It crashed")
17
+ rack_env = {"key" => "value"}
18
+ app = lambda { |env| raise exception }
19
+ rack_stack = Bugsnag::Rack.new(app)
20
+
21
+ it "re-raises the exception" do
22
+ expect { rack_stack.call(rack_env) }.to raise_error(BugsnagTestException)
23
+ end
24
+
25
+ it "delivers an exception if auto_notify is enabled" do
26
+ rack_stack.call(rack_env) rescue nil
27
+
28
+ expect(Bugsnag).to have_sent_notification{ |payload|
29
+ exception_class = payload["events"].first["exceptions"].first["errorClass"]
30
+ expect(exception_class).to eq(exception.class.to_s)
31
+ }
32
+
33
+ end
34
+
35
+ it "does not deliver an exception if auto_notify is disabled" do
36
+ Bugsnag.configure do |config|
37
+ config.auto_notify = false
38
+ end
39
+
40
+ rack_stack.call(rack_env) rescue nil
41
+
42
+ expect(Bugsnag::Notification).not_to have_sent_notification
43
+ end
44
+ end
45
+
46
+ it "don't mess with middlewares list on each req" do
47
+ stub_const('Rack', nil)
48
+ app = lambda { |env| ['200', {}, ['']] }
49
+
50
+ Bugsnag::Rack.new(app)
51
+
52
+ expect { 2.times { Bugsnag::Rack.new(app) } }.not_to change {
53
+ Bugsnag.configuration.middleware.instance_variable_get(:@middlewares)
54
+ }
55
+ end
56
+ end
@@ -0,0 +1,53 @@
1
+ require 'bugsnag'
2
+
3
+ require 'webmock/rspec'
4
+ require 'rspec/expectations'
5
+
6
+ class BugsnagTestException < RuntimeError; end
7
+
8
+ def get_event_from_payload(payload)
9
+ expect(payload["events"].size).to eq(1)
10
+ payload["events"].first
11
+ end
12
+
13
+ def get_exception_from_payload(payload)
14
+ event = get_event_from_payload(payload)
15
+ expect(event["exceptions"].size).to eq(1)
16
+ event["exceptions"].last
17
+ end
18
+
19
+ def notify_test_exception(*args)
20
+ Bugsnag.notify(RuntimeError.new("test message"), *args)
21
+ end
22
+
23
+ RSpec.configure do |config|
24
+ config.order = "random"
25
+
26
+ config.before(:each) do
27
+ WebMock.stub_request(:post, "https://notify.bugsnag.com/")
28
+
29
+ Bugsnag.instance_variable_set(:@configuration, Bugsnag::Configuration.new)
30
+ Bugsnag.configure do |config|
31
+ config.api_key = "c9d60ae4c7e70c4b6c4ebd3e8056d2b8"
32
+ config.release_stage = "production"
33
+ config.delivery_method = :synchronous
34
+ # silence logger in tests
35
+ config.logger = Logger.new(StringIO.new)
36
+ end
37
+ end
38
+
39
+ config.after(:each) do
40
+ Bugsnag.configuration.clear_request_data
41
+ end
42
+ end
43
+
44
+ def have_sent_notification(&matcher)
45
+ have_requested(:post, "https://notify.bugsnag.com/").with do |request|
46
+ if matcher
47
+ matcher.call JSON.parse(request.body)
48
+ true
49
+ else
50
+ raise "no matcher provided to have_sent_notification (did you use { })"
51
+ end
52
+ end
53
+ end
metadata ADDED
@@ -0,0 +1,198 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bugsnag-maglev-
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.8.12
5
+ platform: ruby
6
+ authors:
7
+ - James Smith
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-08-19 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: json
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.7'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 1.7.5
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '1.7'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 1.7.5
33
+ - !ruby/object:Gem::Dependency
34
+ name: rake
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ type: :development
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ - !ruby/object:Gem::Dependency
48
+ name: rspec
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ - !ruby/object:Gem::Dependency
62
+ name: rdoc
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ type: :development
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ - !ruby/object:Gem::Dependency
76
+ name: pry
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ - !ruby/object:Gem::Dependency
90
+ name: webmock
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ type: :development
97
+ prerelease: false
98
+ version_requirements: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ description: Ruby notifier for bugsnag.com
104
+ email: james@bugsnag.com
105
+ executables: []
106
+ extensions: []
107
+ extra_rdoc_files:
108
+ - LICENSE.txt
109
+ - README.md
110
+ files:
111
+ - ".document"
112
+ - ".gitignore"
113
+ - ".rspec"
114
+ - ".travis.yml"
115
+ - CHANGELOG.md
116
+ - CONTRIBUTING.md
117
+ - Gemfile
118
+ - LICENSE.txt
119
+ - README.md
120
+ - Rakefile
121
+ - VERSION
122
+ - bugsnag.gemspec
123
+ - lib/bugsnag.rb
124
+ - lib/bugsnag/capistrano.rb
125
+ - lib/bugsnag/capistrano2.rb
126
+ - lib/bugsnag/configuration.rb
127
+ - lib/bugsnag/delay/resque.rb
128
+ - lib/bugsnag/delayed_job.rb
129
+ - lib/bugsnag/delivery.rb
130
+ - lib/bugsnag/delivery/synchronous.rb
131
+ - lib/bugsnag/delivery/thread_queue.rb
132
+ - lib/bugsnag/deploy.rb
133
+ - lib/bugsnag/helpers.rb
134
+ - lib/bugsnag/mailman.rb
135
+ - lib/bugsnag/meta_data.rb
136
+ - lib/bugsnag/middleware/callbacks.rb
137
+ - lib/bugsnag/middleware/mailman.rb
138
+ - lib/bugsnag/middleware/rack_request.rb
139
+ - lib/bugsnag/middleware/rails2_request.rb
140
+ - lib/bugsnag/middleware/rails3_request.rb
141
+ - lib/bugsnag/middleware/rake.rb
142
+ - lib/bugsnag/middleware/sidekiq.rb
143
+ - lib/bugsnag/middleware/warden_user.rb
144
+ - lib/bugsnag/middleware_stack.rb
145
+ - lib/bugsnag/notification.rb
146
+ - lib/bugsnag/rack.rb
147
+ - lib/bugsnag/rails.rb
148
+ - lib/bugsnag/rails/action_controller_rescue.rb
149
+ - lib/bugsnag/rails/active_record_rescue.rb
150
+ - lib/bugsnag/rails/controller_methods.rb
151
+ - lib/bugsnag/railtie.rb
152
+ - lib/bugsnag/rake.rb
153
+ - lib/bugsnag/resque.rb
154
+ - lib/bugsnag/sidekiq.rb
155
+ - lib/bugsnag/tasks.rb
156
+ - lib/bugsnag/tasks/bugsnag.cap
157
+ - lib/bugsnag/tasks/bugsnag.rake
158
+ - lib/bugsnag/version.rb
159
+ - lib/generators/bugsnag/bugsnag_generator.rb
160
+ - rails/init.rb
161
+ - spec/code_spec.rb
162
+ - spec/fixtures/crashes/end_of_file.rb
163
+ - spec/fixtures/crashes/short_file.rb
164
+ - spec/fixtures/crashes/start_of_file.rb
165
+ - spec/fixtures/middleware/internal_info_setter.rb
166
+ - spec/fixtures/middleware/public_info_setter.rb
167
+ - spec/fixtures/tasks/Rakefile
168
+ - spec/helper_spec.rb
169
+ - spec/integration_spec.rb
170
+ - spec/middleware_spec.rb
171
+ - spec/notification_spec.rb
172
+ - spec/rack_spec.rb
173
+ - spec/spec_helper.rb
174
+ homepage: http://github.com/bugsnag/bugsnag-ruby
175
+ licenses:
176
+ - MIT
177
+ metadata: {}
178
+ post_install_message:
179
+ rdoc_options: []
180
+ require_paths:
181
+ - lib
182
+ required_ruby_version: !ruby/object:Gem::Requirement
183
+ requirements:
184
+ - - ">="
185
+ - !ruby/object:Gem::Version
186
+ version: '0'
187
+ required_rubygems_version: !ruby/object:Gem::Requirement
188
+ requirements:
189
+ - - ">="
190
+ - !ruby/object:Gem::Version
191
+ version: '0'
192
+ requirements: []
193
+ rubyforge_project:
194
+ rubygems_version: 2.2.2
195
+ signing_key:
196
+ specification_version: 4
197
+ summary: Ruby notifier for bugsnag.com
198
+ test_files: []