rollbar 2.18.2 → 2.19.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +15 -0
- data/.travis.yml +155 -93
- data/Gemfile +19 -13
- data/README.md +12 -0
- data/gemfiles/rails30.gemfile +17 -10
- data/gemfiles/rails31.gemfile +20 -12
- data/gemfiles/rails32.gemfile +16 -7
- data/gemfiles/rails40.gemfile +16 -5
- data/gemfiles/rails41.gemfile +15 -5
- data/gemfiles/rails42.gemfile +25 -14
- data/gemfiles/rails50.gemfile +15 -8
- data/gemfiles/rails51.gemfile +15 -8
- data/gemfiles/rails52.gemfile +62 -0
- data/gemfiles/ruby_1_8_and_1_9_2.gemfile +2 -2
- data/lib/rails/rollbar_runner.rb +16 -1
- data/lib/rollbar/capistrano.rb +71 -39
- data/lib/rollbar/capistrano3.rb +53 -1
- data/lib/rollbar/capistrano_tasks.rb +131 -0
- data/lib/rollbar/configuration.rb +13 -4
- data/lib/rollbar/delay/active_job.rb +17 -0
- data/lib/rollbar/delay/sidekiq.rb +3 -1
- data/lib/rollbar/delay/thread.rb +1 -1
- data/lib/rollbar/deploy.rb +69 -0
- data/lib/rollbar/item.rb +17 -6
- data/lib/rollbar/middleware/js.rb +25 -3
- data/lib/rollbar/middleware/js/json_value.rb +26 -0
- data/lib/rollbar/notifier.rb +32 -13
- data/lib/rollbar/plugins/active_job.rb +3 -0
- data/lib/rollbar/plugins/rails/controller_methods.rb +2 -1
- data/lib/rollbar/plugins/rails/railtie_mixin.rb +7 -1
- data/lib/rollbar/rake_tasks.rb +126 -67
- data/lib/rollbar/scrubbers/params.rb +6 -0
- data/lib/rollbar/util.rb +75 -45
- data/lib/rollbar/util/hash.rb +15 -6
- data/lib/rollbar/version.rb +1 -1
- data/rollbar.gemspec +2 -3
- metadata +9 -261
- data/lib/rollbar/tasks/rollbar.cap +0 -47
- data/spec/cacert.pem +0 -3988
- data/spec/controllers/home_controller_spec.rb +0 -480
- data/spec/delay/sidekiq_spec.rb +0 -61
- data/spec/delay/sucker_punch_spec.rb +0 -25
- data/spec/delayed/backend/test.rb +0 -140
- data/spec/delayed/serialization/test.rb +0 -0
- data/spec/dummyapp/.gitignore +0 -73
- data/spec/dummyapp/Rakefile +0 -7
- data/spec/dummyapp/app/assets/javascripts/application.js +0 -3
- data/spec/dummyapp/app/assets/stylesheets/application.css.scss +0 -37
- data/spec/dummyapp/app/controllers/application_controller.rb +0 -3
- data/spec/dummyapp/app/controllers/home_controller.rb +0 -60
- data/spec/dummyapp/app/controllers/users_controller.rb +0 -17
- data/spec/dummyapp/app/helpers/.gitkeep +0 -0
- data/spec/dummyapp/app/mailers/.gitkeep +0 -0
- data/spec/dummyapp/app/models/.gitkeep +0 -0
- data/spec/dummyapp/app/models/book.rb +0 -5
- data/spec/dummyapp/app/models/post.rb +0 -9
- data/spec/dummyapp/app/models/user.rb +0 -9
- data/spec/dummyapp/app/views/devise/registrations/edit.html.erb +0 -27
- data/spec/dummyapp/app/views/devise/registrations/new.html.erb +0 -20
- data/spec/dummyapp/app/views/devise/shared/_links.html.erb +0 -25
- data/spec/dummyapp/app/views/home/cause_exception.html.erb +0 -1
- data/spec/dummyapp/app/views/home/index.html.erb +0 -4
- data/spec/dummyapp/app/views/home/report_exception.html.erb +0 -1
- data/spec/dummyapp/app/views/js/test.html.erb +0 -1
- data/spec/dummyapp/app/views/layouts/_messages.html.erb +0 -5
- data/spec/dummyapp/app/views/layouts/_navigation.html.erb +0 -21
- data/spec/dummyapp/app/views/layouts/application.html.erb +0 -25
- data/spec/dummyapp/app/views/layouts/simple.html.erb +0 -18
- data/spec/dummyapp/app/views/users/index.html.erb +0 -8
- data/spec/dummyapp/app/views/users/show.html.erb +0 -3
- data/spec/dummyapp/config.ru +0 -4
- data/spec/dummyapp/config/application.rb +0 -59
- data/spec/dummyapp/config/boot.rb +0 -10
- data/spec/dummyapp/config/database.yml +0 -25
- data/spec/dummyapp/config/environment.rb +0 -5
- data/spec/dummyapp/config/environments/development.rb +0 -37
- data/spec/dummyapp/config/environments/production.rb +0 -67
- data/spec/dummyapp/config/environments/test.rb +0 -37
- data/spec/dummyapp/config/initializers/backtrace_silencers.rb +0 -7
- data/spec/dummyapp/config/initializers/inflections.rb +0 -15
- data/spec/dummyapp/config/initializers/mime_types.rb +0 -5
- data/spec/dummyapp/config/initializers/rollbar.rb +0 -26
- data/spec/dummyapp/config/initializers/secret_token.rb +0 -7
- data/spec/dummyapp/config/initializers/session_store.rb +0 -8
- data/spec/dummyapp/config/initializers/wrap_parameters.rb +0 -16
- data/spec/dummyapp/config/locales/devise.en.yml +0 -58
- data/spec/dummyapp/config/locales/en.yml +0 -5
- data/spec/dummyapp/config/routes.rb +0 -17
- data/spec/dummyapp/config/secrets.yml +0 -2
- data/spec/dummyapp/db/migrate/20121121184652_devise_create_users.rb +0 -46
- data/spec/dummyapp/db/migrate/20121121184654_add_name_to_users.rb +0 -5
- data/spec/dummyapp/db/migrate/20161219184410_create_books.rb +0 -10
- data/spec/dummyapp/db/migrate/20161219185529_add_username_to_users.rb +0 -5
- data/spec/dummyapp/db/schema.rb +0 -41
- data/spec/dummyapp/db/seeds.rb +0 -12
- data/spec/dummyapp/lib/assets/.gitkeep +0 -0
- data/spec/dummyapp/public/404.html +0 -26
- data/spec/dummyapp/public/422.html +0 -26
- data/spec/dummyapp/public/500.html +0 -25
- data/spec/dummyapp/public/favicon.ico +0 -0
- data/spec/dummyapp/script/rails +0 -6
- data/spec/fixtures/file1 +0 -1
- data/spec/fixtures/file2 +0 -1
- data/spec/fixtures/payloads/message.json +0 -25
- data/spec/fixtures/payloads/sample.trace.json +0 -275
- data/spec/fixtures/payloads/sample.trace_chain.json +0 -530
- data/spec/fixtures/plugins/dummy1.rb +0 -5
- data/spec/fixtures/plugins/dummy2.rb +0 -5
- data/spec/generators/rollbar/rollbar_generator_rails30_spec.rb +0 -31
- data/spec/generators/rollbar/rollbar_generator_spec.rb +0 -51
- data/spec/requests/home_spec.rb +0 -49
- data/spec/rollbar/configuration_spec.rb +0 -74
- data/spec/rollbar/delay/delayed_job_spec.rb +0 -22
- data/spec/rollbar/delay/girl_friday_spec.rb +0 -41
- data/spec/rollbar/delay/resque_spec.rb +0 -37
- data/spec/rollbar/delay/shoryuken_spec.rb +0 -44
- data/spec/rollbar/delay/thread_spec.rb +0 -27
- data/spec/rollbar/encoding/encoder_spec.rb +0 -63
- data/spec/rollbar/item/backtrace_spec.rb +0 -26
- data/spec/rollbar/item/frame_spec.rb +0 -267
- data/spec/rollbar/item_spec.rb +0 -736
- data/spec/rollbar/json/oj_spec.rb +0 -18
- data/spec/rollbar/json_spec.rb +0 -110
- data/spec/rollbar/lazy_store_spec.rb +0 -99
- data/spec/rollbar/logger_proxy_spec.rb +0 -69
- data/spec/rollbar/logger_spec.rb +0 -124
- data/spec/rollbar/middleware/js_spec.rb +0 -428
- data/spec/rollbar/middleware/sinatra_spec.rb +0 -197
- data/spec/rollbar/notifier_spec.rb +0 -67
- data/spec/rollbar/plugin_spec.rb +0 -209
- data/spec/rollbar/plugins/active_job_spec.rb +0 -45
- data/spec/rollbar/plugins/delayed_job/job_data_spec.rb +0 -48
- data/spec/rollbar/plugins/delayed_job_spec.rb +0 -129
- data/spec/rollbar/plugins/rack_spec.rb +0 -152
- data/spec/rollbar/plugins/rails_js_spec.rb +0 -19
- data/spec/rollbar/plugins/rake_spec.rb +0 -34
- data/spec/rollbar/plugins/resque/failure_spec.rb +0 -36
- data/spec/rollbar/plugins/sidekiq_spec.rb +0 -169
- data/spec/rollbar/plugins/validations_spec.rb +0 -56
- data/spec/rollbar/plugins_spec.rb +0 -68
- data/spec/rollbar/request_data_extractor_spec.rb +0 -321
- data/spec/rollbar/scrubbers/params_spec.rb +0 -598
- data/spec/rollbar/scrubbers/url_spec.rb +0 -240
- data/spec/rollbar/scrubbers_spec.rb +0 -31
- data/spec/rollbar/sidekig/clear_scope_spec.rb +0 -19
- data/spec/rollbar/truncation/frames_strategy_spec.rb +0 -70
- data/spec/rollbar/truncation/min_body_strategy_spec.rb +0 -57
- data/spec/rollbar/truncation/strings_strategy_spec.rb +0 -89
- data/spec/rollbar/truncation_spec.rb +0 -27
- data/spec/rollbar/util/hash_spec.rb +0 -22
- data/spec/rollbar/util/ip_anonymizer_spec.rb +0 -30
- data/spec/rollbar/util_spec.rb +0 -80
- data/spec/rollbar_bc_spec.rb +0 -380
- data/spec/rollbar_spec.rb +0 -1737
- data/spec/spec_helper.rb +0 -84
- data/spec/support/cause_exception.rb +0 -1
- data/spec/support/encoding_helpers.rb +0 -8
- data/spec/support/encodings/iso_8859_9 +0 -1
- data/spec/support/fixture_helpers.rb +0 -10
- data/spec/support/get_ip_raising.rb +0 -7
- data/spec/support/helpers.rb +0 -5
- data/spec/support/matchers.rb +0 -23
- data/spec/support/notifier_helpers.rb +0 -57
- data/spec/support/rollbar_api.rb +0 -57
- data/spec/support/secure_headers_mocks.rb +0 -83
- data/spec/support/shared_contexts.rb +0 -12
@@ -1,197 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'rollbar/middleware/sinatra'
|
3
|
-
require 'sinatra/base'
|
4
|
-
require 'rack/test'
|
5
|
-
|
6
|
-
class SinatraDummy < Sinatra::Base
|
7
|
-
class DummyError < StandardError; end
|
8
|
-
|
9
|
-
use Rollbar::Middleware::Sinatra
|
10
|
-
|
11
|
-
get '/foo' do
|
12
|
-
raise DummyError.new
|
13
|
-
end
|
14
|
-
|
15
|
-
get '/bar' do
|
16
|
-
'this will not crash'
|
17
|
-
end
|
18
|
-
|
19
|
-
post '/crash_post' do
|
20
|
-
raise DummyError.new
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
describe Rollbar::Middleware::Sinatra, :reconfigure_notifier => true do
|
25
|
-
include Rack::Test::Methods
|
26
|
-
|
27
|
-
def app
|
28
|
-
SinatraDummy
|
29
|
-
end
|
30
|
-
|
31
|
-
let(:logger_mock) { double('logger').as_null_object }
|
32
|
-
|
33
|
-
before do
|
34
|
-
Rollbar.configure do |config|
|
35
|
-
config.logger = logger_mock
|
36
|
-
config.framework = 'Sinatra'
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
let(:uncaught_level) do
|
41
|
-
Rollbar.configuration.uncaught_exception_level
|
42
|
-
end
|
43
|
-
|
44
|
-
let(:expected_report_args) do
|
45
|
-
[uncaught_level, exception, { :use_exception_level_filters => true }]
|
46
|
-
end
|
47
|
-
|
48
|
-
describe '#call' do
|
49
|
-
context 'for a crashing endpoint' do
|
50
|
-
# this is the default for test mode in Sinatra
|
51
|
-
context 'with raise_errors? == true' do
|
52
|
-
let(:exception) { kind_of(SinatraDummy::DummyError) }
|
53
|
-
|
54
|
-
before do
|
55
|
-
allow(app.settings).to receive(:raise_errors?).and_return(true)
|
56
|
-
end
|
57
|
-
|
58
|
-
it 'reports the error to Rollbar API and raises error' do
|
59
|
-
expect(Rollbar).to receive(:log).with(*expected_report_args)
|
60
|
-
|
61
|
-
expect do
|
62
|
-
get '/foo'
|
63
|
-
end.to raise_error(SinatraDummy::DummyError)
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
context 'with raise_errors? == false' do
|
68
|
-
let(:exception) { kind_of(SinatraDummy::DummyError) }
|
69
|
-
|
70
|
-
before do
|
71
|
-
allow(app.settings).to receive(:raise_errors?).and_return(false)
|
72
|
-
end
|
73
|
-
|
74
|
-
it 'reports the error to Rollbar, but nothing is raised' do
|
75
|
-
expect(Rollbar).to receive(:log).with(*expected_report_args)
|
76
|
-
get '/foo'
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
context 'for a NOT crashing endpoint' do
|
82
|
-
it 'doesnt report any error to Rollbar API' do
|
83
|
-
expect(Rollbar).not_to receive(:log)
|
84
|
-
get '/bar'
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
context 'if the middleware itself fails' do
|
89
|
-
let(:exception) { Exception.new }
|
90
|
-
|
91
|
-
before do
|
92
|
-
allow_any_instance_of(described_class).to receive(:framework_error).and_raise(exception)
|
93
|
-
allow(app.settings).to receive(:raise_errors?).and_return(false)
|
94
|
-
end
|
95
|
-
|
96
|
-
it 'reports the report error' do
|
97
|
-
expect(Rollbar).to receive(:log).with(*expected_report_args)
|
98
|
-
|
99
|
-
expect do
|
100
|
-
get '/foo'
|
101
|
-
end.to raise_error(exception)
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
context 'with GET parameters' do
|
106
|
-
let(:exception) { kind_of(SinatraDummy::DummyError) }
|
107
|
-
let(:params) do
|
108
|
-
{
|
109
|
-
'key' => 'value'
|
110
|
-
}
|
111
|
-
end
|
112
|
-
|
113
|
-
it 'appear in the sent payload' do
|
114
|
-
expect do
|
115
|
-
get '/foo', params
|
116
|
-
end.to raise_error(exception)
|
117
|
-
|
118
|
-
expect(Rollbar.last_report[:request][:GET]).to be_eql(params)
|
119
|
-
end
|
120
|
-
end
|
121
|
-
|
122
|
-
context 'with POST parameters' do
|
123
|
-
let(:exception) { kind_of(SinatraDummy::DummyError) }
|
124
|
-
let(:params) do
|
125
|
-
{
|
126
|
-
'key' => 'value'
|
127
|
-
}
|
128
|
-
end
|
129
|
-
|
130
|
-
it 'appear in the sent payload' do
|
131
|
-
expect do
|
132
|
-
post '/crash_post', params
|
133
|
-
end.to raise_error(exception)
|
134
|
-
|
135
|
-
expect(Rollbar.last_report[:request][:POST]).to be_eql(params)
|
136
|
-
end
|
137
|
-
end
|
138
|
-
|
139
|
-
context 'with JSON POST parameters' do
|
140
|
-
let(:exception) { kind_of(SinatraDummy::DummyError) }
|
141
|
-
let(:params) do
|
142
|
-
{
|
143
|
-
'key' => 'value'
|
144
|
-
}
|
145
|
-
end
|
146
|
-
|
147
|
-
it 'appears in the sent payload when application/json is the content type' do
|
148
|
-
expect do
|
149
|
-
post '/crash_post', params.to_json, { 'CONTENT_TYPE' => 'application/json' }
|
150
|
-
end.to raise_error(exception)
|
151
|
-
|
152
|
-
expect(Rollbar.last_report[:request][:body]).to be_eql(params.to_json)
|
153
|
-
end
|
154
|
-
|
155
|
-
it 'appears in the sent payload when the accepts header contains json' do
|
156
|
-
expect do
|
157
|
-
post '/crash_post', params, { 'ACCEPT' => 'application/vnd.github.v3+json' }
|
158
|
-
end.to raise_error(exception)
|
159
|
-
|
160
|
-
expect(Rollbar.last_report[:request][:POST]).to be_eql(params)
|
161
|
-
end
|
162
|
-
end
|
163
|
-
|
164
|
-
it 'resets the notifier scope in every request' do
|
165
|
-
get '/bar'
|
166
|
-
id1 = Rollbar.scope_object.object_id
|
167
|
-
|
168
|
-
get '/bar'
|
169
|
-
id2 = Rollbar.scope_object.object_id
|
170
|
-
|
171
|
-
expect(id1).not_to be_eql(id2)
|
172
|
-
end
|
173
|
-
|
174
|
-
context 'with person data' do
|
175
|
-
let(:exception) { kind_of(SinatraDummy::DummyError) }
|
176
|
-
let(:person_data) do
|
177
|
-
{ 'email' => 'person@example.com' }
|
178
|
-
end
|
179
|
-
|
180
|
-
it 'includes person data from env' do
|
181
|
-
expect do
|
182
|
-
get '/foo', {}, 'rollbar.person_data' => person_data
|
183
|
-
end.to raise_error(exception)
|
184
|
-
|
185
|
-
expect(Rollbar.last_report[:person]).to be_eql(person_data)
|
186
|
-
end
|
187
|
-
|
188
|
-
it 'includes empty person data when not in env' do
|
189
|
-
expect do
|
190
|
-
get '/foo'
|
191
|
-
end.to raise_error(exception)
|
192
|
-
|
193
|
-
expect(Rollbar.last_report[:person]).to be_eql({})
|
194
|
-
end
|
195
|
-
end
|
196
|
-
end
|
197
|
-
end
|
@@ -1,67 +0,0 @@
|
|
1
|
-
require 'rollbar'
|
2
|
-
require 'rollbar/notifier'
|
3
|
-
|
4
|
-
describe Rollbar::Notifier do
|
5
|
-
describe '#scope' do
|
6
|
-
let(:new_scope) do
|
7
|
-
{ 'foo' => 'bar' }
|
8
|
-
end
|
9
|
-
let(:new_config) do
|
10
|
-
{ 'environment' => 'foo' }
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'creates a new notifier with merged scope and configuration' do
|
14
|
-
new_notifier = subject.scope(new_scope, new_config)
|
15
|
-
|
16
|
-
expect(new_notifier).not_to be(subject)
|
17
|
-
expect(subject.configuration.environment).to be_eql(nil)
|
18
|
-
expect(new_notifier.configuration.environment).to be_eql('foo')
|
19
|
-
expect(new_notifier.scope_object['foo']).to be_eql('bar')
|
20
|
-
expect(new_notifier.configuration).not_to be(subject.configuration)
|
21
|
-
expect(new_notifier.scope_object).not_to be(subject.scope_object)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
describe '#scope!' do
|
26
|
-
let(:new_scope) do
|
27
|
-
{ 'foo' => 'bar' }
|
28
|
-
end
|
29
|
-
let(:new_config) do
|
30
|
-
{ 'environment' => 'foo' }
|
31
|
-
end
|
32
|
-
|
33
|
-
it 'mutates the notifier with a merged scope and configuration' do
|
34
|
-
result = subject.scope!(new_scope, new_config)
|
35
|
-
|
36
|
-
expect(result).to be(subject)
|
37
|
-
expect(subject.configuration.environment).to be_eql('foo')
|
38
|
-
expect(subject.scope_object['foo']).to be_eql('bar')
|
39
|
-
expect(subject.configuration).to be(subject.configuration)
|
40
|
-
expect(subject.scope_object).to be(subject.scope_object)
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
if RUBY_PLATFORM == 'java'
|
45
|
-
describe '#extract_arguments' do
|
46
|
-
# See https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html
|
47
|
-
# for more background
|
48
|
-
it 'extracts java.lang.Exception' do
|
49
|
-
begin
|
50
|
-
raise java.lang.Exception.new('Hello')
|
51
|
-
rescue => e
|
52
|
-
message, exception, extra = Rollbar::Notifier.new.send(:extract_arguments, [e])
|
53
|
-
expect(exception).to eq(e)
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
it 'extracts java.lang.Error' do
|
58
|
-
begin
|
59
|
-
raise java.lang.AssertionError.new('Hello')
|
60
|
-
rescue java.lang.Error => e
|
61
|
-
message, exception, extra = Rollbar::Notifier.new.send(:extract_arguments, [e])
|
62
|
-
expect(exception).to eq(e)
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
data/spec/rollbar/plugin_spec.rb
DELETED
@@ -1,209 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'rollbar/plugin'
|
3
|
-
|
4
|
-
describe Rollbar::Plugin do
|
5
|
-
describe '#load!' do
|
6
|
-
subject { described_class.new(:plugin) }
|
7
|
-
|
8
|
-
before { subject.instance_eval(&plugin_proc) }
|
9
|
-
|
10
|
-
context 'with requires not passing' do
|
11
|
-
let(:dummy_object) { '' }
|
12
|
-
let(:plugin_proc) do
|
13
|
-
dummy = dummy_object
|
14
|
-
|
15
|
-
proc do
|
16
|
-
require_dependency('rollbar')
|
17
|
-
dependency do
|
18
|
-
true
|
19
|
-
end
|
20
|
-
|
21
|
-
execute do
|
22
|
-
dummy.upcase
|
23
|
-
end
|
24
|
-
|
25
|
-
execute do
|
26
|
-
dummy.downcase
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
it 'doesnt finish loading the plugin' do
|
32
|
-
expect(dummy_object).to receive(:upcase)
|
33
|
-
expect(dummy_object).to receive(:downcase)
|
34
|
-
|
35
|
-
subject.load!
|
36
|
-
|
37
|
-
expect(subject.loaded).to be_eql(true)
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
context 'with requires not passing' do
|
42
|
-
let(:dummy_object) { '' }
|
43
|
-
let(:plugin_proc) do
|
44
|
-
dummy = dummy_object
|
45
|
-
|
46
|
-
proc do
|
47
|
-
require_dependency('sure-this-doesnt-exists')
|
48
|
-
dependency do
|
49
|
-
true
|
50
|
-
end
|
51
|
-
|
52
|
-
execute do
|
53
|
-
dummy.upcase
|
54
|
-
end
|
55
|
-
|
56
|
-
execute do
|
57
|
-
dummy.downcase
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
it 'doesnt finish loading the plugin' do
|
63
|
-
expect(dummy_object).not_to receive(:upcase)
|
64
|
-
expect(dummy_object).not_to receive(:downcase)
|
65
|
-
|
66
|
-
subject.load!
|
67
|
-
|
68
|
-
expect(subject.loaded).to be_eql(false)
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
context 'with true dependencies' do
|
73
|
-
let(:dummy_object) { '' }
|
74
|
-
let(:plugin_proc) do
|
75
|
-
dummy = dummy_object
|
76
|
-
|
77
|
-
proc do
|
78
|
-
dependency do
|
79
|
-
true
|
80
|
-
end
|
81
|
-
|
82
|
-
dependency do
|
83
|
-
1 == 1.0
|
84
|
-
end
|
85
|
-
|
86
|
-
execute do
|
87
|
-
dummy.upcase
|
88
|
-
end
|
89
|
-
|
90
|
-
execute do
|
91
|
-
dummy.downcase
|
92
|
-
end
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
it 'calls the callables' do
|
97
|
-
expect(dummy_object).to receive(:upcase).once
|
98
|
-
expect(dummy_object).to receive(:downcase).once
|
99
|
-
|
100
|
-
subject.load!
|
101
|
-
|
102
|
-
expect(subject.loaded).to be_eql(true)
|
103
|
-
end
|
104
|
-
end
|
105
|
-
|
106
|
-
context 'with dependencies failing' do
|
107
|
-
let(:dummy_object) { '' }
|
108
|
-
let(:plugin_proc) do
|
109
|
-
dummy = dummy_object
|
110
|
-
|
111
|
-
proc do
|
112
|
-
dependency do
|
113
|
-
true
|
114
|
-
end
|
115
|
-
|
116
|
-
dependency do
|
117
|
-
raise StandardError.new('the-error')
|
118
|
-
end
|
119
|
-
|
120
|
-
execute do
|
121
|
-
dummy.upcase
|
122
|
-
end
|
123
|
-
|
124
|
-
execute do
|
125
|
-
dummy.downcase
|
126
|
-
end
|
127
|
-
end
|
128
|
-
end
|
129
|
-
|
130
|
-
it 'doesnt finish loading the plugin' do
|
131
|
-
expect(dummy_object).not_to receive(:upcase)
|
132
|
-
expect(dummy_object).not_to receive(:downcase)
|
133
|
-
expect(Rollbar).to receive(:log_error).with("Error trying to load plugin 'plugin': StandardError, the-error")
|
134
|
-
|
135
|
-
subject.load!
|
136
|
-
|
137
|
-
expect(subject.loaded).to be_eql(false)
|
138
|
-
end
|
139
|
-
end
|
140
|
-
|
141
|
-
context 'with callables failing' do
|
142
|
-
let(:dummy_object) { '' }
|
143
|
-
let(:plugin_proc) do
|
144
|
-
dummy = dummy_object
|
145
|
-
|
146
|
-
proc do
|
147
|
-
dependency do
|
148
|
-
true
|
149
|
-
end
|
150
|
-
|
151
|
-
dependency do
|
152
|
-
1 == 1.0
|
153
|
-
end
|
154
|
-
|
155
|
-
execute do
|
156
|
-
raise StandardError.new('the-error')
|
157
|
-
end
|
158
|
-
|
159
|
-
execute do
|
160
|
-
dummy.downcase
|
161
|
-
end
|
162
|
-
end
|
163
|
-
end
|
164
|
-
|
165
|
-
it 'doesnt finish loading the plugin' do
|
166
|
-
expect(dummy_object).not_to receive(:downcase)
|
167
|
-
expect(Rollbar).to receive(:log_error).with("Error trying to load plugin 'plugin': StandardError, the-error")
|
168
|
-
|
169
|
-
subject.load!
|
170
|
-
|
171
|
-
expect(subject.loaded).to be_eql(true)
|
172
|
-
end
|
173
|
-
end
|
174
|
-
|
175
|
-
context 'with false dependencies' do
|
176
|
-
let(:dummy_object) { '' }
|
177
|
-
let(:plugin_proc) do
|
178
|
-
dummy = dummy_object
|
179
|
-
|
180
|
-
proc do
|
181
|
-
dependency do
|
182
|
-
true
|
183
|
-
end
|
184
|
-
|
185
|
-
dependency do
|
186
|
-
1 == 2.0
|
187
|
-
end
|
188
|
-
|
189
|
-
execute do
|
190
|
-
dummy.upcase
|
191
|
-
end
|
192
|
-
|
193
|
-
execute do
|
194
|
-
dummy.downcase
|
195
|
-
end
|
196
|
-
end
|
197
|
-
end
|
198
|
-
|
199
|
-
it 'calls the callables' do
|
200
|
-
expect(dummy_object).not_to receive(:upcase)
|
201
|
-
expect(dummy_object).not_to receive(:downcase)
|
202
|
-
|
203
|
-
subject.load!
|
204
|
-
|
205
|
-
expect(subject.loaded).to be_eql(false)
|
206
|
-
end
|
207
|
-
end
|
208
|
-
end
|
209
|
-
end
|