rollbar 2.18.2 → 2.19.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (167) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +15 -0
  3. data/.travis.yml +155 -93
  4. data/Gemfile +19 -13
  5. data/README.md +12 -0
  6. data/gemfiles/rails30.gemfile +17 -10
  7. data/gemfiles/rails31.gemfile +20 -12
  8. data/gemfiles/rails32.gemfile +16 -7
  9. data/gemfiles/rails40.gemfile +16 -5
  10. data/gemfiles/rails41.gemfile +15 -5
  11. data/gemfiles/rails42.gemfile +25 -14
  12. data/gemfiles/rails50.gemfile +15 -8
  13. data/gemfiles/rails51.gemfile +15 -8
  14. data/gemfiles/rails52.gemfile +62 -0
  15. data/gemfiles/ruby_1_8_and_1_9_2.gemfile +2 -2
  16. data/lib/rails/rollbar_runner.rb +16 -1
  17. data/lib/rollbar/capistrano.rb +71 -39
  18. data/lib/rollbar/capistrano3.rb +53 -1
  19. data/lib/rollbar/capistrano_tasks.rb +131 -0
  20. data/lib/rollbar/configuration.rb +13 -4
  21. data/lib/rollbar/delay/active_job.rb +17 -0
  22. data/lib/rollbar/delay/sidekiq.rb +3 -1
  23. data/lib/rollbar/delay/thread.rb +1 -1
  24. data/lib/rollbar/deploy.rb +69 -0
  25. data/lib/rollbar/item.rb +17 -6
  26. data/lib/rollbar/middleware/js.rb +25 -3
  27. data/lib/rollbar/middleware/js/json_value.rb +26 -0
  28. data/lib/rollbar/notifier.rb +32 -13
  29. data/lib/rollbar/plugins/active_job.rb +3 -0
  30. data/lib/rollbar/plugins/rails/controller_methods.rb +2 -1
  31. data/lib/rollbar/plugins/rails/railtie_mixin.rb +7 -1
  32. data/lib/rollbar/rake_tasks.rb +126 -67
  33. data/lib/rollbar/scrubbers/params.rb +6 -0
  34. data/lib/rollbar/util.rb +75 -45
  35. data/lib/rollbar/util/hash.rb +15 -6
  36. data/lib/rollbar/version.rb +1 -1
  37. data/rollbar.gemspec +2 -3
  38. metadata +9 -261
  39. data/lib/rollbar/tasks/rollbar.cap +0 -47
  40. data/spec/cacert.pem +0 -3988
  41. data/spec/controllers/home_controller_spec.rb +0 -480
  42. data/spec/delay/sidekiq_spec.rb +0 -61
  43. data/spec/delay/sucker_punch_spec.rb +0 -25
  44. data/spec/delayed/backend/test.rb +0 -140
  45. data/spec/delayed/serialization/test.rb +0 -0
  46. data/spec/dummyapp/.gitignore +0 -73
  47. data/spec/dummyapp/Rakefile +0 -7
  48. data/spec/dummyapp/app/assets/javascripts/application.js +0 -3
  49. data/spec/dummyapp/app/assets/stylesheets/application.css.scss +0 -37
  50. data/spec/dummyapp/app/controllers/application_controller.rb +0 -3
  51. data/spec/dummyapp/app/controllers/home_controller.rb +0 -60
  52. data/spec/dummyapp/app/controllers/users_controller.rb +0 -17
  53. data/spec/dummyapp/app/helpers/.gitkeep +0 -0
  54. data/spec/dummyapp/app/mailers/.gitkeep +0 -0
  55. data/spec/dummyapp/app/models/.gitkeep +0 -0
  56. data/spec/dummyapp/app/models/book.rb +0 -5
  57. data/spec/dummyapp/app/models/post.rb +0 -9
  58. data/spec/dummyapp/app/models/user.rb +0 -9
  59. data/spec/dummyapp/app/views/devise/registrations/edit.html.erb +0 -27
  60. data/spec/dummyapp/app/views/devise/registrations/new.html.erb +0 -20
  61. data/spec/dummyapp/app/views/devise/shared/_links.html.erb +0 -25
  62. data/spec/dummyapp/app/views/home/cause_exception.html.erb +0 -1
  63. data/spec/dummyapp/app/views/home/index.html.erb +0 -4
  64. data/spec/dummyapp/app/views/home/report_exception.html.erb +0 -1
  65. data/spec/dummyapp/app/views/js/test.html.erb +0 -1
  66. data/spec/dummyapp/app/views/layouts/_messages.html.erb +0 -5
  67. data/spec/dummyapp/app/views/layouts/_navigation.html.erb +0 -21
  68. data/spec/dummyapp/app/views/layouts/application.html.erb +0 -25
  69. data/spec/dummyapp/app/views/layouts/simple.html.erb +0 -18
  70. data/spec/dummyapp/app/views/users/index.html.erb +0 -8
  71. data/spec/dummyapp/app/views/users/show.html.erb +0 -3
  72. data/spec/dummyapp/config.ru +0 -4
  73. data/spec/dummyapp/config/application.rb +0 -59
  74. data/spec/dummyapp/config/boot.rb +0 -10
  75. data/spec/dummyapp/config/database.yml +0 -25
  76. data/spec/dummyapp/config/environment.rb +0 -5
  77. data/spec/dummyapp/config/environments/development.rb +0 -37
  78. data/spec/dummyapp/config/environments/production.rb +0 -67
  79. data/spec/dummyapp/config/environments/test.rb +0 -37
  80. data/spec/dummyapp/config/initializers/backtrace_silencers.rb +0 -7
  81. data/spec/dummyapp/config/initializers/inflections.rb +0 -15
  82. data/spec/dummyapp/config/initializers/mime_types.rb +0 -5
  83. data/spec/dummyapp/config/initializers/rollbar.rb +0 -26
  84. data/spec/dummyapp/config/initializers/secret_token.rb +0 -7
  85. data/spec/dummyapp/config/initializers/session_store.rb +0 -8
  86. data/spec/dummyapp/config/initializers/wrap_parameters.rb +0 -16
  87. data/spec/dummyapp/config/locales/devise.en.yml +0 -58
  88. data/spec/dummyapp/config/locales/en.yml +0 -5
  89. data/spec/dummyapp/config/routes.rb +0 -17
  90. data/spec/dummyapp/config/secrets.yml +0 -2
  91. data/spec/dummyapp/db/migrate/20121121184652_devise_create_users.rb +0 -46
  92. data/spec/dummyapp/db/migrate/20121121184654_add_name_to_users.rb +0 -5
  93. data/spec/dummyapp/db/migrate/20161219184410_create_books.rb +0 -10
  94. data/spec/dummyapp/db/migrate/20161219185529_add_username_to_users.rb +0 -5
  95. data/spec/dummyapp/db/schema.rb +0 -41
  96. data/spec/dummyapp/db/seeds.rb +0 -12
  97. data/spec/dummyapp/lib/assets/.gitkeep +0 -0
  98. data/spec/dummyapp/public/404.html +0 -26
  99. data/spec/dummyapp/public/422.html +0 -26
  100. data/spec/dummyapp/public/500.html +0 -25
  101. data/spec/dummyapp/public/favicon.ico +0 -0
  102. data/spec/dummyapp/script/rails +0 -6
  103. data/spec/fixtures/file1 +0 -1
  104. data/spec/fixtures/file2 +0 -1
  105. data/spec/fixtures/payloads/message.json +0 -25
  106. data/spec/fixtures/payloads/sample.trace.json +0 -275
  107. data/spec/fixtures/payloads/sample.trace_chain.json +0 -530
  108. data/spec/fixtures/plugins/dummy1.rb +0 -5
  109. data/spec/fixtures/plugins/dummy2.rb +0 -5
  110. data/spec/generators/rollbar/rollbar_generator_rails30_spec.rb +0 -31
  111. data/spec/generators/rollbar/rollbar_generator_spec.rb +0 -51
  112. data/spec/requests/home_spec.rb +0 -49
  113. data/spec/rollbar/configuration_spec.rb +0 -74
  114. data/spec/rollbar/delay/delayed_job_spec.rb +0 -22
  115. data/spec/rollbar/delay/girl_friday_spec.rb +0 -41
  116. data/spec/rollbar/delay/resque_spec.rb +0 -37
  117. data/spec/rollbar/delay/shoryuken_spec.rb +0 -44
  118. data/spec/rollbar/delay/thread_spec.rb +0 -27
  119. data/spec/rollbar/encoding/encoder_spec.rb +0 -63
  120. data/spec/rollbar/item/backtrace_spec.rb +0 -26
  121. data/spec/rollbar/item/frame_spec.rb +0 -267
  122. data/spec/rollbar/item_spec.rb +0 -736
  123. data/spec/rollbar/json/oj_spec.rb +0 -18
  124. data/spec/rollbar/json_spec.rb +0 -110
  125. data/spec/rollbar/lazy_store_spec.rb +0 -99
  126. data/spec/rollbar/logger_proxy_spec.rb +0 -69
  127. data/spec/rollbar/logger_spec.rb +0 -124
  128. data/spec/rollbar/middleware/js_spec.rb +0 -428
  129. data/spec/rollbar/middleware/sinatra_spec.rb +0 -197
  130. data/spec/rollbar/notifier_spec.rb +0 -67
  131. data/spec/rollbar/plugin_spec.rb +0 -209
  132. data/spec/rollbar/plugins/active_job_spec.rb +0 -45
  133. data/spec/rollbar/plugins/delayed_job/job_data_spec.rb +0 -48
  134. data/spec/rollbar/plugins/delayed_job_spec.rb +0 -129
  135. data/spec/rollbar/plugins/rack_spec.rb +0 -152
  136. data/spec/rollbar/plugins/rails_js_spec.rb +0 -19
  137. data/spec/rollbar/plugins/rake_spec.rb +0 -34
  138. data/spec/rollbar/plugins/resque/failure_spec.rb +0 -36
  139. data/spec/rollbar/plugins/sidekiq_spec.rb +0 -169
  140. data/spec/rollbar/plugins/validations_spec.rb +0 -56
  141. data/spec/rollbar/plugins_spec.rb +0 -68
  142. data/spec/rollbar/request_data_extractor_spec.rb +0 -321
  143. data/spec/rollbar/scrubbers/params_spec.rb +0 -598
  144. data/spec/rollbar/scrubbers/url_spec.rb +0 -240
  145. data/spec/rollbar/scrubbers_spec.rb +0 -31
  146. data/spec/rollbar/sidekig/clear_scope_spec.rb +0 -19
  147. data/spec/rollbar/truncation/frames_strategy_spec.rb +0 -70
  148. data/spec/rollbar/truncation/min_body_strategy_spec.rb +0 -57
  149. data/spec/rollbar/truncation/strings_strategy_spec.rb +0 -89
  150. data/spec/rollbar/truncation_spec.rb +0 -27
  151. data/spec/rollbar/util/hash_spec.rb +0 -22
  152. data/spec/rollbar/util/ip_anonymizer_spec.rb +0 -30
  153. data/spec/rollbar/util_spec.rb +0 -80
  154. data/spec/rollbar_bc_spec.rb +0 -380
  155. data/spec/rollbar_spec.rb +0 -1737
  156. data/spec/spec_helper.rb +0 -84
  157. data/spec/support/cause_exception.rb +0 -1
  158. data/spec/support/encoding_helpers.rb +0 -8
  159. data/spec/support/encodings/iso_8859_9 +0 -1
  160. data/spec/support/fixture_helpers.rb +0 -10
  161. data/spec/support/get_ip_raising.rb +0 -7
  162. data/spec/support/helpers.rb +0 -5
  163. data/spec/support/matchers.rb +0 -23
  164. data/spec/support/notifier_helpers.rb +0 -57
  165. data/spec/support/rollbar_api.rb +0 -57
  166. data/spec/support/secure_headers_mocks.rb +0 -83
  167. data/spec/support/shared_contexts.rb +0 -12
@@ -1,45 +0,0 @@
1
- require 'spec_helper'
2
-
3
- require 'active_support/rescuable'
4
-
5
- describe Rollbar::ActiveJob do
6
- class TestJob
7
- # To mix in rescue_from
8
- include ActiveSupport::Rescuable
9
- include Rollbar::ActiveJob
10
-
11
- attr_reader :job_id
12
- attr_accessor :arguments
13
-
14
- def initialize(*arguments)
15
- @arguments = arguments
16
- end
17
-
18
- def perform(exception, job_id)
19
- @job_id = job_id
20
- # ActiveJob calls rescue_with_handler when a job raises an exception
21
- rescue_with_handler(exception) || raise(exception)
22
- end
23
- end
24
-
25
- before { reconfigure_notifier }
26
-
27
- let(:exception) { StandardError.new('oh no') }
28
- let(:job_id) { "123" }
29
- let(:argument) { 12 }
30
-
31
- it "reports the error to Rollbar" do
32
- expected_params = {
33
- :job => "TestJob",
34
- :job_id => job_id,
35
- :use_exception_level_filters => true,
36
- :arguments => [argument]
37
- }
38
- expect(Rollbar).to receive(:error).with(exception, expected_params)
39
- TestJob.new(argument).perform(exception, job_id) rescue nil
40
- end
41
-
42
- it "reraises the error so the job backend can handle the failure and retry" do
43
- expect { TestJob.new(argument).perform(exception, job_id) }.to raise_error exception
44
- end
45
- end
@@ -1,48 +0,0 @@
1
- require 'spec_helper'
2
- require 'rollbar/plugins/delayed_job/job_data'
3
- require 'delayed/backend/test'
4
-
5
- # In delayed_job/lib/delayed/syck_ext.rb YAML.load_dj
6
- # is broken cause it's defined as an instance method
7
- # instead of module/class method. This is breaking
8
- # the tests for ruby 1.8.7
9
- if YAML.parser.class.name =~ /syck|yecht/i
10
- module YAML
11
- def self.load_dj(yaml)
12
- # See https://github.com/dtao/safe_yaml
13
- # When the method is there, we need to load our YAML like this...
14
- respond_to?(:unsafe_load) ? load(yaml, :safe => false) : load(yaml)
15
- end
16
- end
17
- end
18
-
19
- describe Rollbar::Delayed::JobData do
20
- describe '#to_hash' do
21
- let(:handler) { { 'foo' => 'bar' } }
22
-
23
- let(:attrs) do
24
- {
25
- 'id' => 1,
26
- 'priority' => 0,
27
- 'attempts' => 1,
28
- 'handler' => handler.to_yaml
29
- }
30
- end
31
-
32
- let(:job) do
33
- ::Delayed::Backend::Test::Job.new(attrs)
34
- end
35
-
36
- subject { described_class.new(job) }
37
-
38
- it 'returns the correct job data' do
39
- expected_result = attrs.dup
40
- expected_result.delete('id')
41
- expected_result['handler'] = handler
42
-
43
- result = subject.to_hash
44
-
45
- expect(result).to be_eql(expected_result)
46
- end
47
- end
48
- end
@@ -1,129 +0,0 @@
1
- require 'spec_helper'
2
- require 'rollbar'
3
- require 'delayed_job'
4
- require 'delayed/backend/test'
5
-
6
- Rollbar.plugins.load!
7
-
8
- describe Rollbar::Delayed, :reconfigure_notifier => true do
9
- class FailingJob
10
- class TestException < Exception; end
11
-
12
- def do_job_please!(a, b)
13
- this = will_crash_again!
14
- end
15
- end
16
-
17
- before do
18
- Delayed::Backend::Test.prepare_worker
19
-
20
- Delayed::Worker.backend = :test
21
- Delayed::Backend::Test::Job.delete_all
22
- end
23
-
24
- let(:expected_args) do
25
- [kind_of(NoMethodError), { :use_exception_level_filters => true }]
26
- end
27
-
28
- context 'with delayed method without arguments failing' do
29
- it 'sends the exception' do
30
- expect(Rollbar).to receive(:scope).with(kind_of(Hash)).and_call_original
31
- expect_any_instance_of(Rollbar::Notifier).to receive(:error).with(*expected_args)
32
-
33
- FailingJob.new.delay.do_job_please!(:foo, :bar)
34
- end
35
- end
36
-
37
- context 'with failed deserialization' do
38
- let(:expected_args) do
39
- [/Delayed::DeserializationError/, {:use_exception_level_filters=>true}]
40
- end
41
-
42
- it 'sends the exception' do
43
- expect(Rollbar).to receive(:scope).with(kind_of(Hash)).and_call_original
44
- allow_any_instance_of(Delayed::Backend::Base).to receive(:payload_object).and_raise(Delayed::DeserializationError)
45
- expect_any_instance_of(Rollbar::Notifier).to receive(:error).with(*expected_args)
46
-
47
- FailingJob.new.delay.do_job_please!(:foo, :bar)
48
- end
49
-
50
- context 'with dj_threshold > 0' do
51
- before do
52
- Rollbar.configure do |config|
53
- config.dj_threshold = 1
54
- end
55
- end
56
-
57
- it 'sends the exception' do
58
- expect(Rollbar).to receive(:scope).with(kind_of(Hash)).and_call_original
59
- allow_any_instance_of(Delayed::Backend::Base).to receive(:payload_object).and_raise(Delayed::DeserializationError)
60
- expect_any_instance_of(Rollbar::Notifier).to receive(:error).with(*expected_args)
61
-
62
- FailingJob.new.delay.do_job_please!(:foo, :bar)
63
- end
64
- end
65
- end
66
-
67
- describe '.build_job_data' do
68
- let(:job) { double(:payload_object => {}) }
69
-
70
- context 'if report_dj_data is disabled' do
71
- before do
72
- allow(Rollbar.configuration).to receive(:report_dj_data).and_return(false)
73
- end
74
-
75
- it 'returns nil' do
76
- expect(described_class.build_job_data(job)).to be_nil
77
- end
78
- end
79
-
80
- context 'with report_dj_data enabled' do
81
- before do
82
- allow(Rollbar.configuration).to receive(:report_dj_data).and_return(true)
83
- end
84
-
85
- it 'returns a hash' do
86
- result = described_class.build_job_data(job)
87
- expect(result).to be_kind_of(Hash)
88
- end
89
- end
90
- end
91
-
92
- describe '.skip_report' do
93
- let(:configuration) { Rollbar.configuration }
94
- let(:threshold) { 5 }
95
-
96
- before do
97
- allow(configuration).to receive(:dj_threshold).and_return(threshold)
98
- end
99
-
100
- context 'with attempts > configuration.dj_threshold' do
101
- let(:object) do
102
- double(:to_s => 'foo')
103
- end
104
- let(:payload_object) do
105
- double(:method_name => 'foo',
106
- :args => [1, 2],
107
- :object => object)
108
- end
109
- let(:job) do
110
- double(
111
- :attempts => 6,
112
- :job => { :payload_object => payload_object }
113
- )
114
- end
115
-
116
- it 'returns true' do
117
- expect(described_class.skip_report?(job)).to be(false)
118
- end
119
- end
120
-
121
- context 'with attempts < configuration.dj_threshold' do
122
- let(:job) { double(:attempts => 3) }
123
-
124
- it 'returns false' do
125
- expect(described_class.skip_report?(job)).to be(true)
126
- end
127
- end
128
- end
129
- end
@@ -1,152 +0,0 @@
1
- require 'spec_helper'
2
- require 'rack'
3
- require 'rack/builder'
4
- require 'rack/mock'
5
- require 'rollbar'
6
-
7
- Rollbar.plugins.load!
8
-
9
- describe Rollbar::Middleware::Rack::Builder, :reconfigure_notifier => true do
10
- class RackMockError < Exception; end
11
-
12
- let(:action) do
13
- proc { fail(RackMockError, 'the-error') }
14
- end
15
-
16
- let(:app) do
17
- action_proc = action
18
-
19
- ::Rack::Builder.new { run action_proc }
20
- end
21
-
22
- let(:request) do
23
- ::Rack::MockRequest.new(app)
24
- end
25
-
26
- let(:exception) { kind_of(RackMockError) }
27
- let(:uncaught_level) { Rollbar.configuration.uncaught_exception_level }
28
-
29
- it 'reports the error to Rollbar' do
30
- expect(Rollbar).to receive(:log).with(uncaught_level, exception, :use_exception_level_filters => true)
31
- expect { request.get('/will_crash') }.to raise_error(exception)
32
- end
33
-
34
- context 'with GET parameters' do
35
- let(:params) do
36
- { 'key' => 'value' }
37
- end
38
-
39
- it 'sends them to Rollbar' do
40
- expect do
41
- request.get('/will_crash', :params => params)
42
- end.to raise_error(exception)
43
-
44
- expect(Rollbar.last_report[:request][:GET]).to be_eql(params)
45
- end
46
- end
47
-
48
- context 'with JSON body parameters' do
49
- let(:params) do
50
- { 'key' => 'value' }
51
- end
52
-
53
- it 'sends them to Rollbar' do
54
- expect do
55
- request.post('/will_crash', :input => params.to_json, 'CONTENT_TYPE' => 'application/json')
56
- end.to raise_error(exception)
57
-
58
- expect(Rollbar.last_report[:request][:body]).to be_eql(params.to_json)
59
- end
60
- end
61
-
62
- context 'with array POST parameters' do
63
- let(:params) do
64
- [{ :key => 'value'}, 'string', 10]
65
- end
66
-
67
- it 'sends a body.multi key in params' do
68
- expect do
69
- request.post('/will_crash', :input => params.to_json, 'CONTENT_TYPE' => 'application/json')
70
- end.to raise_error(exception)
71
-
72
- reported_body = Rollbar.last_report[:request][:body]
73
- expect(reported_body).to be_eql({ 'body.multi' => [{'key' => 'value'}, 'string', 10] }.to_json)
74
- end
75
- end
76
-
77
- context 'with not array or hash POST parameters' do
78
- let(:params) { 1000 }
79
-
80
- it 'sends a body.multi key in params' do
81
- expect do
82
- request.post('/will_crash', :input => params.to_json, 'CONTENT_TYPE' => 'application/json')
83
- end.to raise_error(exception)
84
-
85
- reported_body = Rollbar.last_report[:request][:body]
86
- expect(reported_body).to be_eql({ 'body.value' => params }.to_json)
87
- end
88
- end
89
-
90
- context 'with multiple HTTP_X_FORWARDED_PROTO values' do
91
- let(:headers) do
92
- { 'HTTP_X_FORWARDED_PROTO' => 'https,http' }
93
- end
94
-
95
- it 'uses the first scheme to generate the url' do
96
- expect do
97
- request.post('/will_crash', headers)
98
- end.to raise_error(exception)
99
-
100
- last_report = Rollbar.last_report
101
- expect(last_report[:request][:url]).to match(/https:/)
102
- end
103
- end
104
-
105
- context 'without HTTP_X_FORWARDED_PROTO' do
106
- it 'uses the the url_scheme set by Rack' do
107
- expect do
108
- request.post('/will_crash')
109
- end.to raise_error(exception)
110
-
111
- last_report = Rollbar.last_report
112
- expect(last_report[:request][:url]).to match(/http:/)
113
- end
114
- end
115
-
116
- context 'with single HTTP_X_FORWARDED_PROTO value' do
117
- let(:headers) do
118
- { 'HTTP_X_FORWARDED_PROTO' => 'https' }
119
- end
120
-
121
- it 'uses the scheme received in X-Forwarded-Proto header' do
122
- expect do
123
- request.post('/will_crash', headers)
124
- end.to raise_error(exception)
125
-
126
- last_report = Rollbar.last_report
127
- expect(last_report[:request][:url]).to match(/https:/)
128
- end
129
- end
130
-
131
- context 'with person data' do
132
- let(:person_data) do
133
- { 'email' => 'person@example.com' }
134
- end
135
-
136
- it 'includes person data from env' do
137
- expect do
138
- request.get('/will_crash', 'rollbar.person_data' => person_data)
139
- end.to raise_error(exception)
140
-
141
- expect(Rollbar.last_report[:person]).to be_eql(person_data)
142
- end
143
-
144
- it 'includes empty person data when not in env' do
145
- expect do
146
- request.get('/will_crash')
147
- end.to raise_error(exception)
148
-
149
- expect(Rollbar.last_report[:person]).to be_eql({})
150
- end
151
- end
152
- end
@@ -1,19 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe ApplicationController, :type => 'request' do
4
- before do
5
- Rollbar.configure do |config|
6
- config.js_options = { :foo => :bar }
7
- config.js_enabled = true
8
- end
9
- end
10
-
11
- it 'renders the snippet and config in the response', :type => 'request' do
12
- get '/test_rollbar_js'
13
-
14
- snippet_from_submodule = File.read(File.expand_path('../../../../rollbar.js/dist/rollbar.snippet.js', __FILE__))
15
-
16
- expect(response.body).to include("var _rollbarConfig = #{Rollbar::configuration.js_options.to_json};")
17
- expect(response.body).to include(snippet_from_submodule)
18
- end
19
- end
@@ -1,34 +0,0 @@
1
- require 'spec_helper'
2
-
3
- Rollbar.plugins.load!
4
-
5
- describe Rollbar::Rake do
6
- let(:application) { Rake.application }
7
- let(:exception) { Exception.new }
8
-
9
- context 'with supported rake version' do
10
- before do
11
- allow(Rollbar::Rake).to receive(:rake_version).and_return('0.9.0')
12
- end
13
-
14
- it 'reports error to Rollbar' do
15
- expect(Rollbar).to receive(:error).with(exception, :use_exception_level_filters => true)
16
- expect(application).to receive(:orig_display_error_message).with(exception)
17
-
18
- Rollbar::Rake.patch! # Really here Rake is already patched
19
- application.display_error_message(exception)
20
- end
21
- end
22
-
23
- context 'with unsupported rake version' do
24
- before do
25
- allow(Rollbar::Rake).to receive(:rake_version).and_return('0.8.7')
26
- end
27
-
28
- it 'reports error to Rollbar' do
29
- expect(Rollbar::Rake).to receive(:skip_patch)
30
-
31
- Rollbar::Rake.patch!
32
- end
33
- end
34
- end
@@ -1,36 +0,0 @@
1
- require 'spec_helper'
2
- require 'rollbar/plugins/resque/failure'
3
-
4
- describe Resque::Failure::Rollbar do
5
- let(:exception) { StandardError.new('BOOM') }
6
- let(:worker) { Resque::Worker.new(:test) }
7
- let(:queue) { 'test' }
8
- let(:payload) { { 'class' => Object, 'args' => 89 } }
9
- let(:backend) do
10
- Resque::Failure::Rollbar.new(exception, worker, queue, payload)
11
- end
12
-
13
- context 'with Rollbar version <= 1.3' do
14
- before do
15
- allow(backend).to receive(:rollbar_version).and_return('1.3.0')
16
- end
17
-
18
- it 'should be notified of an error' do
19
- expect_any_instance_of(Rollbar::Notifier).to receive(:log).with('error', exception, payload)
20
- backend.save
21
- end
22
- end
23
-
24
- context 'with Rollbar version > 1.3' do
25
- let(:payload_with_options) { payload.merge(:use_exception_level_filters => true) }
26
-
27
- before do
28
- allow(backend).to receive(:rollbar_version).and_return('1.4.0')
29
- end
30
-
31
- it 'sends the :use_exception_level_filters option' do
32
- expect_any_instance_of(Rollbar::Notifier).to receive(:error).with(exception, payload_with_options)
33
- backend.save
34
- end
35
- end
36
- end