rollbar 2.18.2 → 2.19.0
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.
- 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,31 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
begin
|
|
4
|
-
require 'genspec'
|
|
5
|
-
rescue LoadError
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
require 'generators/rollbar/rollbar_generator'
|
|
9
|
-
|
|
10
|
-
describe :rollbar do
|
|
11
|
-
context "with no arguments" do
|
|
12
|
-
it "outputs a help message" do
|
|
13
|
-
subject.should output(/You'll need to add an environment variable ROLLBAR_ACCESS_TOKEN with your access token/)
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
it "generates a Rollbar initializer with ENV" do
|
|
17
|
-
subject.should generate("config/initializers/rollbar.rb") { |content|
|
|
18
|
-
content.should =~ /config.access_token = ENV\['ROLLBAR_ACCESS_TOKEN'\]/
|
|
19
|
-
}
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
with_args 'aaaabbbbccccddddeeeeffff00001111' do
|
|
24
|
-
it "generates a Rollbar initializer with access token" do
|
|
25
|
-
subject.should generate("config/initializers/rollbar.rb") do |content|
|
|
26
|
-
content.should =~ /aaaabbbbccccddddeeeeffff00001111/
|
|
27
|
-
content.should =~ /config.access_token = 'aaaabbbbccccddddeeeeffff00001111'/
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
end if Rails::VERSION::STRING.start_with?('3.0')
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
begin
|
|
4
|
-
require 'generator_spec'
|
|
5
|
-
rescue LoadError
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
require 'generators/rollbar/rollbar_generator'
|
|
9
|
-
|
|
10
|
-
describe Rollbar::Generators::RollbarGenerator, :type => :generator do
|
|
11
|
-
destination File.expand_path('../../../tmp', __FILE__)
|
|
12
|
-
|
|
13
|
-
before { prepare_destination }
|
|
14
|
-
|
|
15
|
-
context 'with no arguments' do
|
|
16
|
-
before do
|
|
17
|
-
run_generator
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
it 'outputs a help message and generates Rollbar initializer with ENV' do
|
|
21
|
-
expect(destination_root).to have_structure {
|
|
22
|
-
directory 'config' do
|
|
23
|
-
directory 'initializers' do
|
|
24
|
-
file 'rollbar.rb' do
|
|
25
|
-
contains "config.access_token = ENV\['ROLLBAR_ACCESS_TOKEN'\]"
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
}
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
context 'with arguments' do
|
|
34
|
-
before do
|
|
35
|
-
run_generator(%w(aaaabbbbccccddddeeeeffff00001111))
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
it 'generates a Rollbar initializer with access token' do
|
|
39
|
-
expect(destination_root).to have_structure {
|
|
40
|
-
directory 'config' do
|
|
41
|
-
directory 'initializers' do
|
|
42
|
-
file 'rollbar.rb' do
|
|
43
|
-
contains 'aaaabbbbccccddddeeeeffff00001111'
|
|
44
|
-
contains "config.access_token = 'aaaabbbbccccddddeeeeffff00001111'"
|
|
45
|
-
end
|
|
46
|
-
end
|
|
47
|
-
end
|
|
48
|
-
}
|
|
49
|
-
end
|
|
50
|
-
end
|
|
51
|
-
end unless Rails::VERSION::STRING.start_with?('3.0')
|
data/spec/requests/home_spec.rb
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
describe HomeController do
|
|
4
|
-
let(:logger_mock) { double("Rails.logger").as_null_object }
|
|
5
|
-
|
|
6
|
-
before(:each) do
|
|
7
|
-
reset_configuration
|
|
8
|
-
reconfigure_notifier
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
context "with broken request" do
|
|
12
|
-
it "should report uncaught exceptions" do
|
|
13
|
-
# only seems to be relevant in 3.1 and 3.2
|
|
14
|
-
if ::Rails::VERSION::STRING.starts_with? "3.1" or ::Rails::VERSION::STRING.starts_with? "3.2"
|
|
15
|
-
expect { get '/current_user', nil, :cookie => '8%B' }.to raise_exception
|
|
16
|
-
|
|
17
|
-
Rollbar.last_report.should_not be_nil
|
|
18
|
-
|
|
19
|
-
exception_info = Rollbar.last_report[:body][:trace][:exception]
|
|
20
|
-
exception_info[:class].should == 'ArgumentError'
|
|
21
|
-
exception_info[:message].should == 'invalid %-encoding (8%B)'
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
context "with error hiding deep inside" do
|
|
27
|
-
let!(:cookie_method_name){ :[] }
|
|
28
|
-
let!(:original_cookie_method){ ActionDispatch::Cookies::CookieJar.instance_method(cookie_method_name) }
|
|
29
|
-
let!(:broken_cookie_method){ Proc.new{ |name| "1" - 1 } }
|
|
30
|
-
|
|
31
|
-
before(:each) do
|
|
32
|
-
ActionDispatch::Cookies::CookieJar.send(:define_method, cookie_method_name, broken_cookie_method)
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
after do
|
|
36
|
-
ActionDispatch::Cookies::CookieJar.send(:define_method, cookie_method_name, original_cookie_method)
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
it "should report uncaught exceptions" do
|
|
40
|
-
expect { get '/current_user' }.to raise_exception(NoMethodError)
|
|
41
|
-
|
|
42
|
-
body = Rollbar.last_report[:body]
|
|
43
|
-
trace = body[:trace] && body[:trace] || body[:trace_chain][0]
|
|
44
|
-
|
|
45
|
-
trace[:exception][:class].should == 'NoMethodError'
|
|
46
|
-
trace[:exception][:message].should =~ /^undefined method `-'/
|
|
47
|
-
end
|
|
48
|
-
end
|
|
49
|
-
end
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
require 'rollbar/configuration'
|
|
3
|
-
|
|
4
|
-
describe Rollbar::Configuration do
|
|
5
|
-
|
|
6
|
-
describe '#use_thread' do
|
|
7
|
-
it 'enables async and sets a Thread as handler' do
|
|
8
|
-
subject.use_thread
|
|
9
|
-
|
|
10
|
-
expect(subject.use_async).to be_eql(true)
|
|
11
|
-
expect(subject.async_handler).to be_eql(Rollbar::Delay::Thread)
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
describe '#use_resque' do
|
|
16
|
-
it 'enables async and sets Resque as the handler' do
|
|
17
|
-
require 'resque'
|
|
18
|
-
subject.use_resque(:queue => 'errors')
|
|
19
|
-
|
|
20
|
-
expect(subject.use_async).to be_eql(true)
|
|
21
|
-
expect(subject.async_handler).to be_eql(Rollbar::Delay::Resque)
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
describe '#merge' do
|
|
26
|
-
it 'returns a new object with overrided values' do
|
|
27
|
-
subject.environment = 'foo'
|
|
28
|
-
|
|
29
|
-
new_config = subject.merge(:environment => 'bar')
|
|
30
|
-
|
|
31
|
-
expect(new_config).not_to be(subject)
|
|
32
|
-
expect(new_config.environment).to be_eql('bar')
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
describe '#merge!' do
|
|
37
|
-
it 'returns the same object with overrided values' do
|
|
38
|
-
subject.environment = 'foo'
|
|
39
|
-
|
|
40
|
-
new_config = subject.merge!(:environment => 'bar')
|
|
41
|
-
|
|
42
|
-
expect(new_config).to be(subject)
|
|
43
|
-
expect(new_config.environment).to be_eql('bar')
|
|
44
|
-
end
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
describe '#hook' do
|
|
48
|
-
it "assigns and returns the appropriate hook" do
|
|
49
|
-
subject.hook :on_error_response do
|
|
50
|
-
puts "foo hook"
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
expect(subject.hook(:on_error_response).is_a?(Proc)).to be_eql(true)
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
it "raises a StandardError if requested hook is not supported" do
|
|
57
|
-
expect{ subject.hook(:foo) }.to raise_error(StandardError)
|
|
58
|
-
end
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
describe '#execute_hook' do
|
|
62
|
-
it "executes the approriate hook" do
|
|
63
|
-
bar = "test value"
|
|
64
|
-
|
|
65
|
-
subject.hook :on_error_response do
|
|
66
|
-
bar = "changed value"
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
subject.execute_hook :on_error_response
|
|
70
|
-
|
|
71
|
-
expect(bar).to be_eql("changed value")
|
|
72
|
-
end
|
|
73
|
-
end
|
|
74
|
-
end
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
require 'delayed_job'
|
|
4
|
-
require 'delayed/worker'
|
|
5
|
-
require 'rollbar/delay/delayed_job'
|
|
6
|
-
require 'delayed/backend/test'
|
|
7
|
-
|
|
8
|
-
describe Rollbar::Delay::DelayedJob do
|
|
9
|
-
before do
|
|
10
|
-
Delayed::Backend::Test.prepare_worker
|
|
11
|
-
Delayed::Worker.backend = :test
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
describe '.call' do
|
|
15
|
-
let(:payload) { {} }
|
|
16
|
-
it 'calls Rollbar' do
|
|
17
|
-
expect(Rollbar).to receive(:process_from_async_handler).with(payload)
|
|
18
|
-
|
|
19
|
-
Rollbar::Delay::DelayedJob.call(payload)
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
end
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
# require girl_friday in the test instead in the implementation
|
|
4
|
-
# just to let the user decide to load it or not
|
|
5
|
-
require 'girl_friday'
|
|
6
|
-
require 'rollbar/delay/girl_friday'
|
|
7
|
-
|
|
8
|
-
describe Rollbar::Delay::GirlFriday do
|
|
9
|
-
before do
|
|
10
|
-
queue_class = ::GirlFriday::WorkQueue.immediate!
|
|
11
|
-
allow(::Rollbar::Delay::GirlFriday).to receive(:queue_class).and_return(queue_class)
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
describe '.call' do
|
|
15
|
-
let(:payload) do
|
|
16
|
-
{ :key => 'value' }
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
it 'push the payload into the queue' do
|
|
20
|
-
expect(Rollbar).to receive(:process_from_async_handler).with(payload)
|
|
21
|
-
|
|
22
|
-
described_class.call(payload)
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
context 'with exceptions processing payload' do
|
|
26
|
-
let(:exception) { Exception.new }
|
|
27
|
-
|
|
28
|
-
before do
|
|
29
|
-
expect(Rollbar).to receive(:process_from_async_handler).with(payload).and_raise(exception)
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
it 'raises an exception cause we are using immediate queue' do
|
|
33
|
-
# This will not happen with a norma work queue cause this:
|
|
34
|
-
# https://github.com/mperham/girl_friday/blob/master/lib/girl_friday/work_queue.rb#L90-L106
|
|
35
|
-
expect do
|
|
36
|
-
described_class.call(payload)
|
|
37
|
-
end.to raise_error(exception)
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
end
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
require 'rollbar/delay/resque'
|
|
3
|
-
|
|
4
|
-
describe Rollbar::Delay::Resque do
|
|
5
|
-
describe '.call' do
|
|
6
|
-
let(:payload) do
|
|
7
|
-
{ :key => 'value' }
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
let(:loaded_hash) do
|
|
11
|
-
Rollbar::JSON.load(Rollbar::JSON.dump(payload))
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
before do
|
|
15
|
-
allow(Resque).to receive(:inline?).and_return(true)
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
it 'process the payload' do
|
|
19
|
-
expect(Rollbar).to receive(:process_from_async_handler).with(loaded_hash)
|
|
20
|
-
described_class.call(payload)
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
context 'with exceptions processing payload' do
|
|
24
|
-
let(:exception) { Exception.new }
|
|
25
|
-
|
|
26
|
-
before do
|
|
27
|
-
expect(Rollbar).to receive(:process_from_async_handler).with(loaded_hash).and_raise(exception)
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
it 'raises an exception' do
|
|
31
|
-
expect do
|
|
32
|
-
described_class.call(payload)
|
|
33
|
-
end.to raise_error(exception)
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
end
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
begin
|
|
4
|
-
require 'rollbar/delay/shoryuken'
|
|
5
|
-
rescue LoadError
|
|
6
|
-
module Rollbar
|
|
7
|
-
module Delay
|
|
8
|
-
class Shoryuken; end
|
|
9
|
-
end
|
|
10
|
-
end
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
describe Rollbar::Delay::Shoryuken, :if => RUBY_VERSION != '1.8.7' && RUBY_VERSION != '1.9.2' do
|
|
14
|
-
describe '.call' do
|
|
15
|
-
let(:payload) do
|
|
16
|
-
{ :key => 'value' }
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
let(:loaded_hash) do
|
|
20
|
-
Rollbar::JSON.load(Rollbar::JSON.dump(payload))
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
it 'process the payload' do
|
|
24
|
-
Shoryuken.worker_executor = Shoryuken::Worker::InlineExecutor
|
|
25
|
-
expect(Rollbar).to receive(:process_from_async_handler).with(loaded_hash)
|
|
26
|
-
described_class.call(payload)
|
|
27
|
-
Shoryuken.worker_executor = Shoryuken::Worker::DefaultExecutor
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
context 'with non-default queue name' do
|
|
31
|
-
let(:sqs_queue) { double('non_default_queue') }
|
|
32
|
-
|
|
33
|
-
before do
|
|
34
|
-
Rollbar.configure { |config| config.use_shoryuken(:queue => 'non_default_queue') }
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
it 'uses specified queue' do
|
|
38
|
-
expect(Shoryuken::Client).to receive(:queues).with('non_default_queue').and_return(sqs_queue)
|
|
39
|
-
expect(sqs_queue).to receive(:send_message)
|
|
40
|
-
described_class.call(payload)
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
end
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
describe Rollbar::Delay::Thread do
|
|
4
|
-
describe '.call' do
|
|
5
|
-
let(:payload) { { :key => 'value' } }
|
|
6
|
-
|
|
7
|
-
it 'process the payload in a new thread' do
|
|
8
|
-
expect(Rollbar).to receive(:process_from_async_handler).with(payload)
|
|
9
|
-
|
|
10
|
-
described_class.call(payload).join
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
context 'with exceptions processing payload' do
|
|
14
|
-
let(:exception) { StandardError.new }
|
|
15
|
-
|
|
16
|
-
before do
|
|
17
|
-
expect(Rollbar).to receive(:process_from_async_handler).with(payload).and_raise(exception)
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
it 'doesnt raise any exception' do
|
|
21
|
-
expect do
|
|
22
|
-
described_class.call(payload).join
|
|
23
|
-
end.not_to raise_error
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
end
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
# encoding: utf-8
|
|
2
|
-
require 'spec_helper'
|
|
3
|
-
|
|
4
|
-
unless RUBY_VERSION.start_with?('1.8')
|
|
5
|
-
require 'rollbar/encoding/encoder'
|
|
6
|
-
|
|
7
|
-
describe Rollbar::Encoding::Encoder do
|
|
8
|
-
subject { described_class.new(object) }
|
|
9
|
-
|
|
10
|
-
shared_examples 'encoding' do
|
|
11
|
-
it 'encodes ir properly' do
|
|
12
|
-
value = subject.encode
|
|
13
|
-
|
|
14
|
-
expect(value).to be_eql(expected)
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
describe '#encode' do
|
|
19
|
-
context 'with ascii chars at end of string' do
|
|
20
|
-
it_behaves_like 'encoding' do
|
|
21
|
-
let(:object) { force_to_ascii("bad value 1\255") }
|
|
22
|
-
let(:expected) { 'bad value 1' }
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
context 'with ascii chars at middle of string' do
|
|
27
|
-
it_behaves_like 'encoding' do
|
|
28
|
-
let(:object) { force_to_ascii("bad\255 value 2") }
|
|
29
|
-
let(:expected) { 'bad value 2' }
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
context 'with ascii chars at end of string' do
|
|
34
|
-
it_behaves_like 'encoding' do
|
|
35
|
-
let(:object) { force_to_ascii("bad value 3\255") }
|
|
36
|
-
let(:expected) { 'bad value 3' }
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
context '0xa0 char in exception object' do
|
|
41
|
-
it_behaves_like 'encoding' do
|
|
42
|
-
let(:object) { "foo \xa0".force_encoding(::Encoding::ISO_8859_1) }
|
|
43
|
-
let(:expected) { "foo " }
|
|
44
|
-
end
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
context 'with bad symbol' do
|
|
48
|
-
it_behaves_like 'encoding' do
|
|
49
|
-
let(:bad_string) { force_to_ascii("inner \x92bad key") }
|
|
50
|
-
let(:object) { bad_string.to_sym }
|
|
51
|
-
let(:expected) { :"inner bad key" }
|
|
52
|
-
end
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
context 'with russian chars in string' do
|
|
56
|
-
it_behaves_like 'encoding' do
|
|
57
|
-
let(:object) { 'Изменение' }
|
|
58
|
-
let(:expected) { 'Изменение' }
|
|
59
|
-
end
|
|
60
|
-
end
|
|
61
|
-
end
|
|
62
|
-
end
|
|
63
|
-
end
|