File tree Expand file tree Collapse file tree 2 files changed +19
-7
lines changed Expand file tree Collapse file tree 2 files changed +19
-7
lines changed Original file line number Diff line number Diff line change 1
1
Rollbar . plugins . define ( 'thread' ) do
2
- execute do
3
- Thread . class_eval do
4
- def initialize_with_rollbar ( *args , & block )
2
+ module Rollbar
3
+ module ThreadPlugin
4
+ def initialize ( *args )
5
5
self [ :_rollbar_notifier ] ||= Rollbar . notifier . scope
6
- initialize_without_rollbar ( * args , & block )
6
+ super
7
7
end
8
-
9
- alias_method :initialize_without_rollbar , :initialize
10
- alias_method :initialize , :initialize_with_rollbar
11
8
end
12
9
end
10
+
11
+ execute do
12
+ Thread . send ( :prepend , Rollbar ::ThreadPlugin ) # rubocop:disable Lint/SendWithMixinArgument
13
+ end
13
14
end
Original file line number Diff line number Diff line change
1
+ require 'spec_helper'
2
+
3
+ Rollbar . plugins . load!
4
+
5
+ describe Rollbar ::ThreadPlugin do
6
+ subject ( :thread ) { Thread . new { } }
7
+
8
+ it 'has a Rollbar notifier' do
9
+ expect ( thread [ :_rollbar_notifier ] ) . to be_a_kind_of ( Rollbar ::Notifier )
10
+ end
11
+ end
You can’t perform that action at this time.
0 commit comments