appsignal 2.11.10-java → 3.0.0.beta.1-java

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.
Files changed (91) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +4 -1
  3. data/.semaphore/semaphore.yml +161 -70
  4. data/CHANGELOG.md +5 -18
  5. data/Rakefile +3 -13
  6. data/appsignal.gemspec +2 -24
  7. data/build_matrix.yml +20 -22
  8. data/gemfiles/capistrano2.gemfile +1 -0
  9. data/gemfiles/capistrano3.gemfile +1 -0
  10. data/gemfiles/grape.gemfile +1 -0
  11. data/gemfiles/no_dependencies.gemfile +1 -4
  12. data/gemfiles/rails-3.2.gemfile +0 -2
  13. data/gemfiles/rails-4.2.gemfile +0 -6
  14. data/gemfiles/resque-2.gemfile +4 -0
  15. data/gemfiles/sequel-435.gemfile +1 -0
  16. data/gemfiles/sequel.gemfile +1 -0
  17. data/gemfiles/sinatra.gemfile +1 -0
  18. data/lib/appsignal/auth_check.rb +2 -8
  19. data/lib/appsignal/cli.rb +1 -23
  20. data/lib/appsignal/config.rb +0 -24
  21. data/lib/appsignal/event_formatter.rb +0 -25
  22. data/lib/appsignal/extension.rb +0 -50
  23. data/lib/appsignal/hooks/action_cable.rb +5 -44
  24. data/lib/appsignal/hooks/active_support_notifications.rb +7 -86
  25. data/lib/appsignal/hooks/celluloid.rb +5 -9
  26. data/lib/appsignal/hooks/net_http.rb +2 -12
  27. data/lib/appsignal/hooks/puma.rb +3 -5
  28. data/lib/appsignal/hooks/que.rb +1 -1
  29. data/lib/appsignal/hooks/rake.rb +2 -24
  30. data/lib/appsignal/hooks/redis.rb +2 -13
  31. data/lib/appsignal/hooks/resque.rb +2 -43
  32. data/lib/appsignal/hooks/sidekiq.rb +1 -5
  33. data/lib/appsignal/hooks/unicorn.rb +3 -24
  34. data/lib/appsignal/hooks/webmachine.rb +1 -7
  35. data/lib/appsignal/hooks.rb +0 -23
  36. data/lib/appsignal/integrations/action_cable.rb +34 -0
  37. data/lib/appsignal/integrations/active_support_notifications.rb +77 -0
  38. data/lib/appsignal/integrations/net_http.rb +16 -0
  39. data/lib/appsignal/integrations/object.rb +61 -4
  40. data/lib/appsignal/integrations/padrino.rb +5 -7
  41. data/lib/appsignal/integrations/que.rb +26 -33
  42. data/lib/appsignal/integrations/railtie.rb +1 -4
  43. data/lib/appsignal/integrations/rake.rb +26 -2
  44. data/lib/appsignal/integrations/redis.rb +17 -0
  45. data/lib/appsignal/integrations/resque.rb +39 -10
  46. data/lib/appsignal/integrations/unicorn.rb +28 -0
  47. data/lib/appsignal/integrations/webmachine.rb +22 -24
  48. data/lib/appsignal/minutely.rb +0 -18
  49. data/lib/appsignal/transaction.rb +1 -1
  50. data/lib/appsignal/version.rb +1 -1
  51. data/lib/appsignal.rb +1 -27
  52. data/spec/lib/appsignal/auth_check_spec.rb +1 -24
  53. data/spec/lib/appsignal/cli_spec.rb +1 -1
  54. data/spec/lib/appsignal/config_spec.rb +0 -66
  55. data/spec/lib/appsignal/event_formatter_spec.rb +0 -37
  56. data/spec/lib/appsignal/extension_install_failure_spec.rb +7 -0
  57. data/spec/lib/appsignal/extension_spec.rb +9 -43
  58. data/spec/lib/appsignal/hooks/action_cable_spec.rb +0 -88
  59. data/spec/lib/appsignal/hooks/celluloid_spec.rb +6 -1
  60. data/spec/lib/appsignal/hooks/rake_spec.rb +1 -2
  61. data/spec/lib/appsignal/hooks/redis_spec.rb +50 -15
  62. data/spec/lib/appsignal/hooks/sidekiq_spec.rb +7 -61
  63. data/spec/lib/appsignal/hooks/unicorn_spec.rb +14 -3
  64. data/spec/lib/appsignal/hooks/webmachine_spec.rb +2 -13
  65. data/spec/lib/appsignal/hooks_spec.rb +0 -57
  66. data/spec/lib/appsignal/integrations/object_spec.rb +4 -95
  67. data/spec/lib/appsignal/integrations/padrino_spec.rb +2 -3
  68. data/spec/lib/appsignal/integrations/railtie_spec.rb +0 -45
  69. data/spec/lib/appsignal/integrations/webmachine_spec.rb +26 -8
  70. data/spec/lib/appsignal/minutely_spec.rb +0 -19
  71. data/spec/lib/appsignal/transaction_spec.rb +1 -31
  72. data/spec/lib/appsignal/transmitter_spec.rb +1 -1
  73. data/spec/lib/appsignal/utils/data_spec.rb +87 -133
  74. data/spec/lib/appsignal_spec.rb +0 -69
  75. data/spec/lib/puma/appsignal_spec.rb +0 -28
  76. data/spec/spec_helper.rb +1 -37
  77. data/spec/support/testing.rb +1 -11
  78. data/support/install_deps +0 -4
  79. metadata +10 -23
  80. data/lib/appsignal/cli/notify_of_deploy.rb +0 -131
  81. data/lib/appsignal/integrations/object_ruby_19.rb +0 -37
  82. data/lib/appsignal/integrations/object_ruby_modern.rb +0 -41
  83. data/lib/appsignal/integrations/resque_active_job.rb +0 -19
  84. data/lib/appsignal/js_exception_transaction.rb +0 -56
  85. data/lib/appsignal/rack/js_exception_catcher.rb +0 -80
  86. data/spec/lib/appsignal/cli/notify_of_deploy_spec.rb +0 -180
  87. data/spec/lib/appsignal/integrations/object_19_spec.rb +0 -266
  88. data/spec/lib/appsignal/integrations/resque_active_job_spec.rb +0 -28
  89. data/spec/lib/appsignal/integrations/resque_spec.rb +0 -28
  90. data/spec/lib/appsignal/js_exception_transaction_spec.rb +0 -128
  91. data/spec/lib/appsignal/rack/js_exception_catcher_spec.rb +0 -170
@@ -16,31 +16,14 @@ describe Appsignal::Hooks::SidekiqHook do
16
16
  end
17
17
 
18
18
  describe "#install" do
19
- class SidekiqMiddlewareMockWithPrepend < Array
20
- alias add <<
21
- alias exists? include?
22
-
23
- unless method_defined? :prepend
24
- def prepend(middleware) # For Ruby < 2.5
25
- insert(0, middleware)
26
- end
19
+ class SidekiqMiddlewareMock < Set
20
+ def exists?(middleware)
21
+ include?(middleware)
27
22
  end
28
23
  end
29
-
30
- class SidekiqMiddlewareMockWithoutPrepend < Array
31
- alias add <<
32
- alias exists? include?
33
-
34
- undef_method :prepend if method_defined? :prepend # For Ruby >= 2.5
35
- end
36
-
37
24
  module SidekiqMock
38
- def self.middleware_mock=(mock)
39
- @middlewares = mock.new
40
- end
41
-
42
25
  def self.middlewares
43
- @middlewares
26
+ @middlewares ||= SidekiqMiddlewareMock.new
44
27
  end
45
28
 
46
29
  def self.configure_server
@@ -53,52 +36,15 @@ describe Appsignal::Hooks::SidekiqHook do
53
36
  end
54
37
  end
55
38
 
56
- def add_middleware(middleware)
57
- Sidekiq.configure_server do |sidekiq_config|
58
- sidekiq_config.middlewares.add(middleware)
59
- end
60
- end
61
-
62
39
  before do
63
40
  Appsignal.config = project_fixture_config
64
41
  stub_const "Sidekiq", SidekiqMock
65
42
  end
66
43
 
67
- context "when Sidekiq middleware responds to prepend method" do # Sidekiq 3.3.0 and newer
68
- before { Sidekiq.middleware_mock = SidekiqMiddlewareMockWithPrepend }
69
-
70
- it "adds the AppSignal SidekiqPlugin to the Sidekiq middleware chain in the first position" do
71
- user_middleware1 = proc {}
72
- add_middleware(user_middleware1)
73
- described_class.new.install
74
- user_middleware2 = proc {}
75
- add_middleware(user_middleware2)
44
+ it "adds the AppSignal SidekiqPlugin to the Sidekiq middleware chain" do
45
+ described_class.new.install
76
46
 
77
- expect(Sidekiq.server_middleware).to eql([
78
- Appsignal::Hooks::SidekiqPlugin, # Prepend makes it the first entry
79
- user_middleware1,
80
- user_middleware2
81
- ])
82
- end
83
- end
84
-
85
- context "when Sidekiq middleware does not respond to prepend method" do
86
- before { Sidekiq.middleware_mock = SidekiqMiddlewareMockWithoutPrepend }
87
-
88
- it "adds the AppSignal SidekiqPlugin to the Sidekiq middleware chain" do
89
- user_middleware1 = proc {}
90
- add_middleware(user_middleware1)
91
- described_class.new.install
92
- user_middleware2 = proc {}
93
- add_middleware(user_middleware2)
94
-
95
- # Add middlewares in whatever order they were added
96
- expect(Sidekiq.server_middleware).to eql([
97
- user_middleware1,
98
- Appsignal::Hooks::SidekiqPlugin,
99
- user_middleware2
100
- ])
101
- end
47
+ expect(Sidekiq.server_middleware.exists?(Appsignal::Hooks::SidekiqPlugin)).to be(true)
102
48
  end
103
49
  end
104
50
  end
@@ -3,12 +3,22 @@ describe Appsignal::Hooks::UnicornHook do
3
3
  before :context do
4
4
  module Unicorn
5
5
  class HttpServer
6
- def worker_loop(worker)
6
+ def worker_loop(_worker)
7
+ @worker_loop = true
8
+ end
9
+
10
+ def worker_loop?
11
+ @worker_loop == true
7
12
  end
8
13
  end
9
14
 
10
15
  class Worker
11
16
  def close
17
+ @close = true
18
+ end
19
+
20
+ def close?
21
+ @close == true
12
22
  end
13
23
  end
14
24
  end
@@ -27,18 +37,19 @@ describe Appsignal::Hooks::UnicornHook do
27
37
  worker = double
28
38
 
29
39
  expect(Appsignal).to receive(:forked)
30
- expect(server).to receive(:worker_loop_without_appsignal).with(worker)
31
40
 
32
41
  server.worker_loop(worker)
42
+
43
+ expect(server.worker_loop?).to be true
33
44
  end
34
45
 
35
46
  it "adds behavior to Unicorn::Worker#close" do
36
47
  worker = Unicorn::Worker.new
37
48
 
38
49
  expect(Appsignal).to receive(:stop)
39
- expect(worker).to receive(:close_without_appsignal)
40
50
 
41
51
  worker.close
52
+ expect(worker.close?).to be true
42
53
  end
43
54
  end
44
55
 
@@ -10,19 +10,8 @@ describe Appsignal::Hooks::WebmachineHook do
10
10
  it { is_expected.to be_truthy }
11
11
  end
12
12
 
13
- it "should include the run alias methods" do
14
- expect(fsm).to respond_to(:run_with_appsignal)
15
- expect(fsm).to respond_to(:run_without_appsignal)
16
- end
17
-
18
- it "should include the handle_exceptions alias methods" do
19
- expect(
20
- fsm.respond_to?(:handle_exceptions_with_appsignal, true)
21
- ).to be_truthy
22
-
23
- expect(
24
- fsm.respond_to?(:handle_exceptions_without_appsignal, true)
25
- ).to be_truthy
13
+ it "adds behavior to Webmachine::Decision::FSM" do
14
+ expect(fsm.class.ancestors.first).to eq(Appsignal::Integrations::WebmachineIntegration)
26
15
  end
27
16
  end
28
17
  else
@@ -78,63 +78,6 @@ describe Appsignal::Hooks do
78
78
  expect(Appsignal::Hooks.hooks[:mock_error_hook].installed?).to be_falsy
79
79
  Appsignal::Hooks.hooks.delete(:mock_error_hook)
80
80
  end
81
-
82
- describe "missing constants" do
83
- let(:err_stream) { std_stream }
84
- let(:stderr) { err_stream.read }
85
- let(:log_stream) { std_stream }
86
- let(:log) { log_contents(log_stream) }
87
- before do
88
- Appsignal.logger = test_logger(log_stream)
89
- end
90
-
91
- def call_constant(&block)
92
- capture_std_streams(std_stream, err_stream, &block)
93
- end
94
-
95
- describe "SidekiqProbe" do
96
- it "logs a deprecation message and returns the new constant" do
97
- constant = call_constant { Appsignal::Hooks::SidekiqProbe }
98
-
99
- expect(constant).to eql(Appsignal::Probes::SidekiqProbe)
100
- expect(constant.name).to eql("Appsignal::Probes::SidekiqProbe")
101
-
102
- deprecation_message =
103
- "The constant Appsignal::Hooks::SidekiqProbe has been deprecated. " \
104
- "Please update the constant name to Appsignal::Probes::SidekiqProbe " \
105
- "in the following file to remove this message.\n#{__FILE__}:"
106
- expect(stderr).to include "appsignal WARNING: #{deprecation_message}"
107
- expect(log).to contains_log :warn, deprecation_message
108
- end
109
- end
110
-
111
- describe "PumaProbe" do
112
- it "logs a deprecation message and returns the new constant" do
113
- constant = call_constant { Appsignal::Hooks::PumaProbe }
114
-
115
- expect(constant).to eql(Appsignal::Probes::PumaProbe)
116
- expect(constant.name).to eql("Appsignal::Probes::PumaProbe")
117
-
118
- deprecation_message =
119
- "The constant Appsignal::Hooks::PumaProbe has been deprecated. " \
120
- "Please update the constant name to Appsignal::Probes::PumaProbe " \
121
- "in the following file to remove this message.\n#{__FILE__}:"
122
- expect(stderr).to include "appsignal WARNING: #{deprecation_message}"
123
- expect(log).to contains_log :warn, deprecation_message
124
- end
125
- end
126
-
127
- describe "other constant" do
128
- it "raises a NameError like Ruby normally does" do
129
- expect do
130
- call_constant { Appsignal::Hooks::Unknown }
131
- end.to raise_error(NameError)
132
-
133
- expect(stderr).to be_empty
134
- expect(log).to be_empty
135
- end
136
- end
137
- end
138
81
  end
139
82
 
140
83
  describe Appsignal::Hooks::Helpers do
@@ -1,9 +1,5 @@
1
1
  require "appsignal/integrations/object"
2
2
 
3
- def is_ruby_19
4
- RUBY_VERSION < "2.0"
5
- end
6
-
7
3
  describe Object do
8
4
  describe "#instrument_method" do
9
5
  context "with instance method" do
@@ -30,57 +26,12 @@ describe Object do
30
26
  before do
31
27
  Appsignal.config = project_fixture_config
32
28
  expect(Appsignal::Transaction).to receive(:current).at_least(:once).and_return(transaction)
33
- expect(Appsignal.active?).to be_truthy
34
29
  end
35
30
  after { Appsignal.config = nil }
36
31
 
37
- context "with different kind of arguments" do
38
- let(:klass) do
39
- Class.new do
40
- def positional_arguments(param1, param2)
41
- [param1, param2]
42
- end
43
- appsignal_instrument_method :positional_arguments
44
-
45
- def positional_arguments_splat(*params)
46
- params
47
- end
48
- appsignal_instrument_method :positional_arguments_splat
49
-
50
- def keyword_arguments(a: nil, b: nil)
51
- [a, b]
52
- end
53
- appsignal_instrument_method :keyword_arguments
54
-
55
- def keyword_arguments_splat(**kwargs)
56
- kwargs
57
- end
58
- appsignal_instrument_method :keyword_arguments_splat
59
-
60
- def splat(*args, **kwargs)
61
- [args, kwargs]
62
- end
63
- appsignal_instrument_method :splat
64
- end
65
- end
66
-
67
- it "instruments the method and calls it" do
68
- expect(instance.positional_arguments("abc", "def")).to eq(["abc", "def"])
69
- expect(instance.positional_arguments_splat("abc", "def")).to eq(["abc", "def"])
70
- expect(instance.keyword_arguments(:a => "a", :b => "b")).to eq(["a", "b"])
71
- expect(instance.keyword_arguments_splat(:a => "a", :b => "b"))
72
- .to eq(:a => "a", :b => "b")
73
-
74
- expect(instance.splat).to eq([[], {}])
75
- expect(instance.splat(:a => "a", :b => "b")).to eq([[], { :a => "a", :b => "b" }])
76
- expect(instance.splat("abc", "def")).to eq([["abc", "def"], {}])
77
- expect(instance.splat("abc", "def", :a => "a", :b => "b"))
78
- .to eq([["abc", "def"], { :a => "a", :b => "b" }])
79
- end
80
- end
81
-
82
32
  context "with anonymous class" do
83
33
  it "instruments the method and calls it" do
34
+ expect(Appsignal.active?).to be_truthy
84
35
  expect(transaction).to receive(:start_event)
85
36
  expect(transaction).to receive(:finish_event).with \
86
37
  "foo.AnonymousClass.other", nil, nil, Appsignal::EventFormatter::DEFAULT
@@ -101,6 +52,7 @@ describe Object do
101
52
  let(:klass) { NamedClass }
102
53
 
103
54
  it "instruments the method and calls it" do
55
+ expect(Appsignal.active?).to be_truthy
104
56
  expect(transaction).to receive(:start_event)
105
57
  expect(transaction).to receive(:finish_event).with \
106
58
  "foo.NamedClass.other", nil, nil, Appsignal::EventFormatter::DEFAULT
@@ -125,6 +77,7 @@ describe Object do
125
77
  let(:klass) { MyModule::NestedModule::NamedClass }
126
78
 
127
79
  it "instruments the method and calls it" do
80
+ expect(Appsignal.active?).to be_truthy
128
81
  expect(transaction).to receive(:start_event)
129
82
  expect(transaction).to receive(:finish_event).with \
130
83
  "bar.NamedClass.NestedModule.MyModule.other", nil, nil,
@@ -144,6 +97,7 @@ describe Object do
144
97
  end
145
98
 
146
99
  it "instruments with custom name" do
100
+ expect(Appsignal.active?).to be_truthy
147
101
  expect(transaction).to receive(:start_event)
148
102
  expect(transaction).to receive(:finish_event).with \
149
103
  "my_method.group", nil, nil, Appsignal::EventFormatter::DEFAULT
@@ -204,51 +158,6 @@ describe Object do
204
158
  end
205
159
  after { Appsignal.config = nil }
206
160
 
207
- context "with different kind of arguments" do
208
- let(:klass) do
209
- Class.new do
210
- def self.positional_arguments(param1, param2)
211
- [param1, param2]
212
- end
213
- appsignal_instrument_class_method :positional_arguments
214
-
215
- def self.positional_arguments_splat(*params)
216
- params
217
- end
218
- appsignal_instrument_class_method :positional_arguments_splat
219
-
220
- def self.keyword_arguments(a: nil, b: nil)
221
- [a, b]
222
- end
223
- appsignal_instrument_class_method :keyword_arguments
224
-
225
- def self.keyword_arguments_splat(**kwargs)
226
- kwargs
227
- end
228
- appsignal_instrument_class_method :keyword_arguments_splat
229
-
230
- def self.splat(*args, **kwargs)
231
- [args, kwargs]
232
- end
233
- appsignal_instrument_class_method :splat
234
- end
235
- end
236
-
237
- it "instruments the method and calls it" do
238
- expect(klass.positional_arguments("abc", "def")).to eq(["abc", "def"])
239
- expect(klass.positional_arguments_splat("abc", "def")).to eq(["abc", "def"])
240
- expect(klass.keyword_arguments(:a => "a", :b => "b")).to eq(["a", "b"])
241
- expect(klass.keyword_arguments_splat(:a => "a", :b => "b"))
242
- .to eq(:a => "a", :b => "b")
243
-
244
- expect(klass.splat).to eq([[], {}])
245
- expect(klass.splat(:a => "a", :b => "b")).to eq([[], { :a => "a", :b => "b" }])
246
- expect(klass.splat("abc", "def")).to eq([["abc", "def"], {}])
247
- expect(klass.splat("abc", "def", :a => "a", :b => "b"))
248
- .to eq([["abc", "def"], { :a => "a", :b => "b" }])
249
- end
250
- end
251
-
252
161
  context "with anonymous class" do
253
162
  it "instruments the method and calls it" do
254
163
  expect(Appsignal.active?).to be_truthy
@@ -150,10 +150,9 @@ if DependencyHelper.padrino_present?
150
150
  let(:path) { "/static" }
151
151
  before do
152
152
  env["sinatra.static_file"] = true
153
- expect_any_instance_of(app)
154
- .to receive(:route_without_appsignal).and_return([200, {}, ["foo"]])
153
+ app.controllers { get(:static) { "Static!" } }
155
154
  end
156
- after { expect(response).to match_response(200, "foo") }
155
+ after { expect(response).to match_response(200, "Static!") }
157
156
 
158
157
  it "does not instrument the request" do
159
158
  expect_no_transaction_to_be_created
@@ -79,51 +79,6 @@ if DependencyHelper.rails_present?
79
79
 
80
80
  after { Appsignal::Integrations::Railtie.initialize_appsignal(app) }
81
81
  end
82
-
83
- describe "frontend_error_catching middleware" do
84
- let(:config) do
85
- Appsignal::Config.new(
86
- project_fixture_path,
87
- "test",
88
- :name => "MyApp",
89
- :enable_frontend_error_catching => enable_frontend_error_catching
90
- )
91
- end
92
- before { allow(Appsignal::Config).to receive(:new).and_return(config) }
93
- after { Appsignal::Integrations::Railtie.initialize_appsignal(app) }
94
-
95
- context "when enabled" do
96
- let(:enable_frontend_error_catching) { true }
97
-
98
- it "adds the Rails and JSExceptionCatcher middleware" do
99
- expect(app.middleware).to receive(:insert_after).with(
100
- ActionDispatch::DebugExceptions,
101
- Appsignal::Rack::RailsInstrumentation
102
- )
103
-
104
- expect(app.middleware).to receive(:insert_before).with(
105
- Appsignal::Rack::RailsInstrumentation,
106
- Appsignal::Rack::JSExceptionCatcher
107
- )
108
- end
109
- end
110
-
111
- context "when not enabled" do
112
- let(:enable_frontend_error_catching) { false }
113
-
114
- it "adds the Rails middleware, but not the JSExceptionCatcher middleware" do
115
- expect(app.middleware).to receive(:insert_after).with(
116
- ActionDispatch::DebugExceptions,
117
- Appsignal::Rack::RailsInstrumentation
118
- )
119
-
120
- expect(app.middleware).to_not receive(:insert_before).with(
121
- Appsignal::Rack::RailsInstrumentation,
122
- Appsignal::Rack::JSExceptionCatcher
123
- )
124
- end
125
- end
126
- end
127
82
  end
128
83
  end
129
84
  end
@@ -1,12 +1,24 @@
1
1
  if DependencyHelper.webmachine_present?
2
2
  require "appsignal/integrations/webmachine"
3
3
 
4
- describe Appsignal::Integrations::WebmachinePlugin::FSM do
4
+ class Response
5
+ attr_accessor :code
6
+
7
+ def body
8
+ ""
9
+ end
10
+
11
+ def headers
12
+ {}
13
+ end
14
+ end
15
+
16
+ describe Appsignal::Integrations::WebmachineIntegration do
5
17
  let(:request) do
6
18
  Webmachine::Request.new("GET", "http://google.com:80/foo", {}, nil)
7
19
  end
8
- let(:resource) { double(:trace? => false, :handle_exception => true) }
9
- let(:response) { double }
20
+ let(:resource) { double(:trace? => false, :handle_exception => true, :"code=" => nil) }
21
+ let(:response) { Response.new }
10
22
  let(:transaction) { double(:set_action_if_nil => true) }
11
23
  let(:fsm) { Webmachine::Decision::FSM.new(resource, request, response) }
12
24
  before(:context) { start_agent }
@@ -18,10 +30,8 @@ if DependencyHelper.webmachine_present?
18
30
  end
19
31
  end
20
32
 
21
- describe "#run_with_appsignal" do
33
+ describe "#run" do
22
34
  before do
23
- allow(fsm).to receive(:request).and_return(request)
24
- allow(fsm).to receive(:run_without_appsignal).and_return(true)
25
35
  allow(SecureRandom).to receive(:uuid).and_return("uuid")
26
36
  allow(Appsignal::Transaction).to receive(:create).and_return(transaction)
27
37
  end
@@ -40,7 +50,7 @@ if DependencyHelper.webmachine_present?
40
50
  end
41
51
 
42
52
  it "should call the original method" do
43
- expect(fsm).to receive(:run_without_appsignal)
53
+ expect(fsm).to receive(:run)
44
54
  end
45
55
 
46
56
  it "should instrument the original method" do
@@ -52,9 +62,17 @@ if DependencyHelper.webmachine_present?
52
62
  end
53
63
 
54
64
  after { fsm.run }
65
+
66
+ describe "concerning the response" do
67
+ it "sets a response code" do
68
+ expect(fsm.response.code).to be_nil
69
+ fsm.run
70
+ expect(fsm.response.code).not_to be_nil
71
+ end
72
+ end
55
73
  end
56
74
 
57
- describe "#handle_exceptions_with_appsignal" do
75
+ describe "#handle_exceptions" do
58
76
  let(:error) { ExampleException }
59
77
 
60
78
  it "should catch the error and send it to AppSignal" do
@@ -284,25 +284,6 @@ describe Appsignal::Minutely do
284
284
  end
285
285
  end
286
286
 
287
- describe "#<<" do
288
- let(:err_stream) { std_stream }
289
- let(:stderr) { err_stream.read }
290
- let(:log_stream) { std_stream }
291
- let(:log) { log_contents(log_stream) }
292
- before { Appsignal.logger = test_logger(log_stream) }
293
-
294
- it "adds the probe, but prints a deprecation warning" do
295
- probe = lambda {}
296
- capture_std_streams(std_stream, err_stream) { collection << probe }
297
- deprecation_message = "Deprecated " \
298
- "`Appsignal::Minute.probes <<` call. Please use " \
299
- "`Appsignal::Minutely.probes.register` instead."
300
- expect(stderr).to include "appsignal WARNING: #{deprecation_message}"
301
- expect(log).to contains_log :warn, deprecation_message
302
- expect(collection[probe.object_id]).to eql(probe)
303
- end
304
- end
305
-
306
287
  describe "#register" do
307
288
  let(:log_stream) { std_stream }
308
289
  let(:log) { log_contents(log_stream) }
@@ -246,23 +246,6 @@ describe Appsignal::Transaction do
246
246
  expect(transaction.ext).to_not be_nil
247
247
  end
248
248
 
249
- context "when extension is not loaded", :extension_installation_failure do
250
- around do |example|
251
- Appsignal::Testing.without_testing { example.run }
252
- end
253
-
254
- it "does not error on missing extension method calls" do
255
- expect(transaction.ext).to be_kind_of(Appsignal::Extension::MockTransaction)
256
- transaction.start_event
257
- transaction.finish_event(
258
- "name",
259
- "title",
260
- "body",
261
- Appsignal::EventFormatter::DEFAULT
262
- )
263
- end
264
- end
265
-
266
249
  it "sets the transaction id" do
267
250
  expect(transaction.transaction_id).to eq "1"
268
251
  end
@@ -657,7 +640,7 @@ describe Appsignal::Transaction do
657
640
  end
658
641
 
659
642
  context "when the data cannot be converted to JSON" do
660
- it "does not update the sample data on the transaction", :not_ruby19 do
643
+ it "does not update the sample data on the transaction" do
661
644
  klass = Class.new do
662
645
  def to_s
663
646
  raise "foo" # Cause a deliberate error
@@ -669,19 +652,6 @@ describe Appsignal::Transaction do
669
652
  expect(log_contents(log)).to contains_log :error,
670
653
  "Error generating data (RuntimeError: foo) for"
671
654
  end
672
-
673
- it "does not update the sample data on the transaction", :only_ruby19 do
674
- klass = Class.new do
675
- def to_s
676
- raise "foo" # Cause a deliberate error
677
- end
678
- end
679
- transaction.set_sample_data("params", klass.new => 1)
680
-
681
- expect(transaction.to_h["sample_data"]).to eq({})
682
- expect(log_contents(log)).to contains_log :error,
683
- "Error generating data (RuntimeError: foo). Can't inspect data."
684
- end
685
655
  end
686
656
  end
687
657
 
@@ -143,7 +143,7 @@ describe Appsignal::Transmitter do
143
143
  context "with a proxy" do
144
144
  let(:config) { project_fixture_config("production", :http_proxy => "http://localhost:8080") }
145
145
 
146
- it "is of Net::HTTP class", :not_ruby19 do
146
+ it "is of Net::HTTP class" do
147
147
  expect(subject).to be_instance_of(Net::HTTP)
148
148
  end
149
149
  it { expect(subject.proxy?).to be_truthy }