appsignal 2.1.0.beta.1 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +2 -1
- data/CHANGELOG.md +5 -0
- data/README.md +14 -15
- data/appsignal.gemspec +1 -1
- data/lib/appsignal.rb +1 -1
- data/lib/appsignal/auth_check.rb +5 -2
- data/lib/appsignal/cli/demo.rb +1 -1
- data/lib/appsignal/cli/diagnose.rb +1 -1
- data/lib/appsignal/cli/install.rb +1 -1
- data/lib/appsignal/transaction.rb +2 -1
- data/lib/appsignal/version.rb +1 -1
- data/spec/lib/appsignal/auth_check_spec.rb +9 -10
- data/spec/lib/appsignal/capistrano2_spec.rb +6 -6
- data/spec/lib/appsignal/capistrano3_spec.rb +6 -6
- data/spec/lib/appsignal/cli/demo_spec.rb +1 -1
- data/spec/lib/appsignal/cli/diagnose_spec.rb +1 -1
- data/spec/lib/appsignal/cli/helpers_spec.rb +2 -2
- data/spec/lib/appsignal/cli/install_spec.rb +2 -2
- data/spec/lib/appsignal/cli_spec.rb +2 -2
- data/spec/lib/appsignal/config_spec.rb +24 -24
- data/spec/lib/appsignal/demo_spec.rb +4 -2
- data/spec/lib/appsignal/event_formatter/action_view/render_formatter_spec.rb +11 -7
- data/spec/lib/appsignal/event_formatter/active_record/instantiation_formatter_spec.rb +2 -2
- data/spec/lib/appsignal/event_formatter/active_record/sql_formatter_spec.rb +2 -2
- data/spec/lib/appsignal/event_formatter/elastic_search/search_formatter_spec.rb +1 -1
- data/spec/lib/appsignal/event_formatter/faraday/request_formatter_spec.rb +2 -2
- data/spec/lib/appsignal/event_formatter/moped/query_formatter_spec.rb +9 -9
- data/spec/lib/appsignal/event_formatter_spec.rb +17 -17
- data/spec/lib/appsignal/extension_spec.rb +7 -7
- data/spec/lib/appsignal/garbage_collection_profiler_spec.rb +0 -3
- data/spec/lib/appsignal/hooks/active_support_notifications_spec.rb +11 -3
- data/spec/lib/appsignal/hooks/celluloid_spec.rb +12 -4
- data/spec/lib/appsignal/hooks/data_mapper_spec.rb +12 -4
- data/spec/lib/appsignal/hooks/delayed_job_spec.rb +21 -13
- data/spec/lib/appsignal/hooks/mongo_ruby_driver_spec.rb +14 -6
- data/spec/lib/appsignal/hooks/net_http_spec.rb +11 -3
- data/spec/lib/appsignal/hooks/passenger_spec.rb +14 -6
- data/spec/lib/appsignal/hooks/puma_spec.rb +18 -10
- data/spec/lib/appsignal/hooks/rake_spec.rb +2 -2
- data/spec/lib/appsignal/hooks/redis_spec.rb +40 -30
- data/spec/lib/appsignal/hooks/sequel_spec.rb +11 -3
- data/spec/lib/appsignal/hooks/shoryuken_spec.rb +15 -7
- data/spec/lib/appsignal/hooks/sidekiq_spec.rb +17 -9
- data/spec/lib/appsignal/hooks/unicorn_spec.rb +16 -8
- data/spec/lib/appsignal/hooks/webmachine_spec.rb +14 -4
- data/spec/lib/appsignal/hooks_spec.rb +28 -28
- data/spec/lib/appsignal/integrations/data_mapper_spec.rb +1 -1
- data/spec/lib/appsignal/integrations/grape_spec.rb +3 -3
- data/spec/lib/appsignal/integrations/mongo_ruby_driver_spec.rb +14 -16
- data/spec/lib/appsignal/integrations/object_spec.rb +10 -10
- data/spec/lib/appsignal/integrations/padrino_spec.rb +14 -18
- data/spec/lib/appsignal/integrations/railtie_spec.rb +35 -19
- data/spec/lib/appsignal/integrations/resque_active_job_spec.rb +2 -2
- data/spec/lib/appsignal/integrations/resque_spec.rb +8 -8
- data/spec/lib/appsignal/integrations/sinatra_spec.rb +2 -2
- data/spec/lib/appsignal/integrations/webmachine_spec.rb +1 -1
- data/spec/lib/appsignal/js_exception_transaction_spec.rb +1 -1
- data/spec/lib/appsignal/minutely_spec.rb +3 -3
- data/spec/lib/appsignal/rack/generic_instrumentation_spec.rb +12 -12
- data/spec/lib/appsignal/rack/js_exception_catcher_spec.rb +2 -2
- data/spec/lib/appsignal/rack/rails_instrumentation_spec.rb +19 -15
- data/spec/lib/appsignal/rack/sinatra_instrumentation_spec.rb +21 -21
- data/spec/lib/appsignal/rack/streaming_listener_spec.rb +5 -5
- data/spec/lib/appsignal/system_spec.rb +5 -5
- data/spec/lib/appsignal/transaction_spec.rb +176 -155
- data/spec/lib/appsignal/transmitter_spec.rb +29 -23
- data/spec/lib/appsignal/utils/params_sanitizer_spec.rb +49 -35
- data/spec/lib/appsignal/utils_spec.rb +15 -8
- data/spec/lib/appsignal_spec.rb +134 -150
- data/spec/spec_helper.rb +5 -2
- metadata +6 -10
- data/spec/lib/tmp/config/appsignal.yml +0 -2
- data/spec/support/delegate_matcher.rb +0 -38
@@ -11,12 +11,12 @@ describe Appsignal::Transmitter do
|
|
11
11
|
describe "#uri" do
|
12
12
|
subject { instance.uri.to_s }
|
13
13
|
|
14
|
-
it {
|
15
|
-
it {
|
16
|
-
it {
|
17
|
-
it {
|
18
|
-
it {
|
19
|
-
it {
|
14
|
+
it { is_expected.to include "https://push.appsignal.com/1/action?" }
|
15
|
+
it { is_expected.to include "api_key=abc" }
|
16
|
+
it { is_expected.to include "hostname=app1.local" }
|
17
|
+
it { is_expected.to include "name=TestApp" }
|
18
|
+
it { is_expected.to include "environment=production" }
|
19
|
+
it { is_expected.to include "gem_version=#{Appsignal::VERSION}" }
|
20
20
|
end
|
21
21
|
|
22
22
|
describe "#transmit" do
|
@@ -38,7 +38,7 @@ describe Appsignal::Transmitter do
|
|
38
38
|
end
|
39
39
|
subject { instance.transmit(:the => :payload) }
|
40
40
|
|
41
|
-
it {
|
41
|
+
it { is_expected.to eq "200" }
|
42
42
|
|
43
43
|
context "with ca_file_path config option set" do
|
44
44
|
context "when not existing file" do
|
@@ -86,12 +86,17 @@ describe Appsignal::Transmitter do
|
|
86
86
|
describe "#http_post" do
|
87
87
|
subject { instance.send(:http_post, "the" => "payload") }
|
88
88
|
|
89
|
-
|
90
|
-
|
89
|
+
it "gzips the body" do
|
90
|
+
expect(subject.body).to eq Appsignal::Utils::Gzip.compress("{\"the\":\"payload\"}")
|
91
|
+
end
|
92
|
+
|
93
|
+
it "sets the path" do
|
94
|
+
expect(subject.path).to eq instance.uri.request_uri
|
95
|
+
end
|
91
96
|
|
92
|
-
it "
|
93
|
-
subject["Content-Type"].
|
94
|
-
subject["Content-Encoding"].
|
97
|
+
it "sets the correct headers" do
|
98
|
+
expect(subject["Content-Type"]).to eq "application/json; charset=UTF-8"
|
99
|
+
expect(subject["Content-Encoding"]).to eq "gzip"
|
95
100
|
end
|
96
101
|
end
|
97
102
|
|
@@ -101,27 +106,28 @@ describe Appsignal::Transmitter do
|
|
101
106
|
context "with a http uri" do
|
102
107
|
let(:config) { project_fixture_config("test") }
|
103
108
|
|
104
|
-
it {
|
105
|
-
|
106
|
-
|
109
|
+
it { expect(subject).to be_instance_of(Net::HTTP) }
|
110
|
+
it { expect(subject.proxy?).to be_falsy }
|
111
|
+
it { expect(subject.use_ssl?).to be_falsy }
|
107
112
|
end
|
108
113
|
|
109
114
|
context "with a https uri" do
|
110
115
|
let(:config) { project_fixture_config("production") }
|
111
116
|
|
112
|
-
it {
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
+
it { expect(subject).to be_instance_of(Net::HTTP) }
|
118
|
+
it { expect(subject.proxy?).to be_falsy }
|
119
|
+
it { expect(subject.use_ssl?).to be_truthy }
|
120
|
+
it { expect(subject.verify_mode).to eq OpenSSL::SSL::VERIFY_PEER }
|
121
|
+
it { expect(subject.ca_file).to eq config[:ca_file_path] }
|
117
122
|
end
|
118
123
|
|
119
124
|
context "with a proxy" do
|
120
125
|
let(:config) { project_fixture_config("production", :http_proxy => "http://localhost:8080") }
|
121
126
|
|
122
|
-
|
123
|
-
|
124
|
-
|
127
|
+
it { expect(subject).to be_instance_of(Net::HTTP) }
|
128
|
+
it { expect(subject.proxy?).to be_truthy }
|
129
|
+
it { expect(subject.proxy_address).to eq "localhost" }
|
130
|
+
it { expect(subject.proxy_port).to eq 8080 }
|
125
131
|
end
|
126
132
|
end
|
127
133
|
end
|
@@ -29,45 +29,51 @@ describe Appsignal::Utils::ParamsSanitizer do
|
|
29
29
|
let(:sanitized_params) { described_class.sanitize(params) }
|
30
30
|
subject { sanitized_params }
|
31
31
|
|
32
|
-
it {
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
32
|
+
it { is_expected.to be_instance_of Hash }
|
33
|
+
it { expect(subject[:text]).to eq("string") }
|
34
|
+
it { expect(subject["string"]).to eq("string key value") }
|
35
|
+
it do
|
36
|
+
expect(subject[:file]).to be_instance_of String
|
37
|
+
expect(subject[:file]).to include "::UploadedFile"
|
38
|
+
end
|
39
|
+
it { expect(subject[:float]).to eq(0.0) }
|
40
|
+
it { expect(subject[:bool_true]).to be(true) }
|
41
|
+
it { expect(subject[:bool_false]).to be(false) }
|
42
|
+
it { expect(subject[:nil]).to be_nil }
|
43
|
+
it { expect(subject[:int]).to eq(1) }
|
42
44
|
|
43
45
|
it "does not change the original params" do
|
44
46
|
subject
|
45
|
-
params[:file].
|
46
|
-
params[:hash][:nested_array][2].
|
47
|
+
expect(params[:file]).to eq(file)
|
48
|
+
expect(params[:hash][:nested_array][2]).to eq(file)
|
47
49
|
end
|
48
50
|
|
49
51
|
describe ":hash" do
|
50
52
|
subject { sanitized_params[:hash] }
|
51
53
|
|
52
|
-
it {
|
53
|
-
|
54
|
+
it { is_expected.to be_instance_of Hash }
|
55
|
+
it { expect(subject[:nested_text]).to eq("string") }
|
54
56
|
|
55
57
|
describe ":nested_array" do
|
56
58
|
subject { sanitized_params[:hash][:nested_array] }
|
57
59
|
|
58
|
-
it {
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
60
|
+
it { is_expected.to be_instance_of Array }
|
61
|
+
it { expect(subject[0]).to eq("something") }
|
62
|
+
it { expect(subject[1]).to eq("else") }
|
63
|
+
it do
|
64
|
+
expect(subject[2]).to be_instance_of String
|
65
|
+
expect(subject[2]).to include "::UploadedFile"
|
66
|
+
end
|
63
67
|
|
64
68
|
describe ":nested_hash" do
|
65
69
|
subject { sanitized_params[:hash][:nested_array][3] }
|
66
70
|
|
67
|
-
it {
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
+
it { is_expected.to be_instance_of Hash }
|
72
|
+
it { expect(subject[:key]).to eq("value") }
|
73
|
+
it do
|
74
|
+
expect(subject[:file]).to be_instance_of String
|
75
|
+
expect(subject[:file]).to include "::UploadedFile"
|
76
|
+
end
|
71
77
|
end
|
72
78
|
end
|
73
79
|
end
|
@@ -78,22 +84,26 @@ describe Appsignal::Utils::ParamsSanitizer do
|
|
78
84
|
end
|
79
85
|
subject { sanitized_params }
|
80
86
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
87
|
+
it { expect(subject[:text]).to eq(described_class::FILTERED) }
|
88
|
+
it { expect(subject[:hash]).to eq(described_class::FILTERED) }
|
89
|
+
it do
|
90
|
+
expect(subject[:file]).to be_instance_of String
|
91
|
+
expect(subject[:file]).to include "::UploadedFile"
|
92
|
+
end
|
93
|
+
it { expect(subject[:float]).to eq(0.0) }
|
94
|
+
it { expect(subject[:bool_true]).to be(true) }
|
95
|
+
it { expect(subject[:bool_false]).to be(false) }
|
96
|
+
it { expect(subject[:nil]).to be_nil }
|
97
|
+
it { expect(subject[:int]).to eq(1) }
|
90
98
|
|
91
99
|
context "with strings as key filter values" do
|
92
100
|
let(:sanitized_params) do
|
93
101
|
described_class.sanitize(params, :filter_parameters => %w(string))
|
94
102
|
end
|
95
103
|
|
96
|
-
|
104
|
+
it "sanitizes values" do
|
105
|
+
expect(subject["string"]).to eq("[FILTERED]")
|
106
|
+
end
|
97
107
|
end
|
98
108
|
|
99
109
|
describe ":hash" do
|
@@ -102,7 +112,9 @@ describe Appsignal::Utils::ParamsSanitizer do
|
|
102
112
|
end
|
103
113
|
subject { sanitized_params[:hash] }
|
104
114
|
|
105
|
-
|
115
|
+
it "sanitizes values in nested hashes" do
|
116
|
+
expect(subject[:nested_text]).to eq("[FILTERED]")
|
117
|
+
end
|
106
118
|
|
107
119
|
describe ":nested_array" do
|
108
120
|
describe ":nested_hash" do
|
@@ -111,7 +123,9 @@ describe Appsignal::Utils::ParamsSanitizer do
|
|
111
123
|
end
|
112
124
|
subject { sanitized_params[:hash][:nested_array][3] }
|
113
125
|
|
114
|
-
|
126
|
+
it "sanitizes values in deeply nested hashes and arrays" do
|
127
|
+
expect(subject[:key]).to eq("[FILTERED]")
|
128
|
+
end
|
115
129
|
end
|
116
130
|
end
|
117
131
|
end
|
@@ -18,10 +18,15 @@ describe Appsignal::Utils do
|
|
18
18
|
}
|
19
19
|
end
|
20
20
|
|
21
|
-
it {
|
22
|
-
it {
|
23
|
-
it {
|
24
|
-
|
21
|
+
it { is_expected.to eq Appsignal::Utils.data_generate(body) }
|
22
|
+
it { is_expected.to_not eq Appsignal::Utils.data_generate({}) }
|
23
|
+
it { is_expected.to_not eq "a string" }
|
24
|
+
|
25
|
+
describe "#to_s" do
|
26
|
+
it do
|
27
|
+
expect(subject.to_s).to eq %({"":"test","1":true,"bar":null,"baz":{"arr":[1,2],"foo":"bʊr"},"float":1.0,"foo":[1,2,"three",{"foo":"bar"}],"int":1,"the":"payload"})
|
28
|
+
end
|
29
|
+
end
|
25
30
|
end
|
26
31
|
|
27
32
|
context "with a valid array body" do
|
@@ -29,7 +34,7 @@ describe Appsignal::Utils do
|
|
29
34
|
[1, "string", 10, { "foo" => "bʊr" }]
|
30
35
|
end
|
31
36
|
|
32
|
-
|
37
|
+
it { expect(subject.to_s).to eq %([1,\"string\",10,{\"foo\":\"bʊr\"}]) }
|
33
38
|
end
|
34
39
|
|
35
40
|
context "with a body that contains strings with invalid utf-8 content" do
|
@@ -47,7 +52,9 @@ describe Appsignal::Utils do
|
|
47
52
|
}
|
48
53
|
end
|
49
54
|
|
50
|
-
|
55
|
+
describe "#to_s" do
|
56
|
+
it { expect(subject.to_s).to eq %({"field_four":{"one":"aa�"},"field_one":"aa","field_three":["one","aa�"],"field_two":"aa�"}) }
|
57
|
+
end
|
51
58
|
end
|
52
59
|
|
53
60
|
context "with an invalid body" do
|
@@ -76,7 +83,7 @@ describe Appsignal::Utils do
|
|
76
83
|
}
|
77
84
|
end
|
78
85
|
|
79
|
-
it {
|
86
|
+
it { is_expected.to eq %({"the":"payload","1":true,"":"test","foo":[1,2,"three"],"bar":null,"baz":{"foo":"bar"}}) }
|
80
87
|
end
|
81
88
|
|
82
89
|
context "with a body that contains strings with invalid utf-8 content" do
|
@@ -94,7 +101,7 @@ describe Appsignal::Utils do
|
|
94
101
|
}
|
95
102
|
end
|
96
103
|
|
97
|
-
it {
|
104
|
+
it { is_expected.to eq %({"field_one":"aa","field_two":"aa�","field_three":["one","aa�"],"field_four":{"one":"aa�"}}) }
|
98
105
|
end
|
99
106
|
end
|
100
107
|
end
|
data/spec/lib/appsignal_spec.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
require "./spec/support/mocks/mock_extension"
|
2
|
-
|
3
1
|
describe Appsignal do
|
4
2
|
before do
|
5
3
|
# Make sure we have a clean state because we want to test
|
@@ -13,37 +11,37 @@ describe Appsignal do
|
|
13
11
|
describe ".config=" do
|
14
12
|
it "should set the config" do
|
15
13
|
config = project_fixture_config
|
16
|
-
Appsignal.logger.
|
14
|
+
expect(Appsignal.logger).to_not receive(:level=)
|
17
15
|
|
18
16
|
Appsignal.config = config
|
19
|
-
Appsignal.config.
|
17
|
+
expect(Appsignal.config).to eq config
|
20
18
|
end
|
21
19
|
end
|
22
20
|
|
23
21
|
describe ".extensions" do
|
24
22
|
it "should keep a list of extensions" do
|
25
|
-
Appsignal.extensions.
|
23
|
+
expect(Appsignal.extensions).to be_empty
|
26
24
|
Appsignal.extensions << Appsignal::MockExtension
|
27
|
-
Appsignal.extensions.
|
25
|
+
expect(Appsignal.extensions.size).to eq(1)
|
28
26
|
end
|
29
27
|
end
|
30
28
|
|
31
29
|
describe ".start" do
|
32
30
|
context "with no config set beforehand" do
|
33
31
|
it "should do nothing when config is not set and there is no valid config in the env" do
|
34
|
-
Appsignal.logger.
|
32
|
+
expect(Appsignal.logger).to receive(:error).with(
|
35
33
|
"Push api key not set after loading config"
|
36
34
|
).once
|
37
|
-
Appsignal.logger.
|
35
|
+
expect(Appsignal.logger).to receive(:error).with(
|
38
36
|
"Not starting, no valid config for this environment"
|
39
37
|
).once
|
40
|
-
Appsignal::Extension.
|
38
|
+
expect(Appsignal::Extension).to_not receive(:start)
|
41
39
|
Appsignal.start
|
42
40
|
end
|
43
41
|
|
44
42
|
it "should create a config from the env" do
|
45
43
|
ENV["APPSIGNAL_PUSH_API_KEY"] = "something"
|
46
|
-
Appsignal::Extension.
|
44
|
+
expect(Appsignal::Extension).to receive(:start)
|
47
45
|
expect(Appsignal.logger).not_to receive(:error)
|
48
46
|
silence { Appsignal.start }
|
49
47
|
expect(Appsignal.config[:push_api_key]).to eq("something")
|
@@ -55,33 +53,24 @@ describe Appsignal do
|
|
55
53
|
|
56
54
|
it "should initialize logging" do
|
57
55
|
Appsignal.start
|
58
|
-
Appsignal.logger.level.
|
56
|
+
expect(Appsignal.logger.level).to eq Logger::INFO
|
59
57
|
end
|
60
58
|
|
61
59
|
it "should start native" do
|
62
|
-
Appsignal::Extension.
|
60
|
+
expect(Appsignal::Extension).to receive(:start)
|
63
61
|
Appsignal.start
|
64
62
|
end
|
65
63
|
|
66
64
|
it "should initialize formatters" do
|
67
|
-
Appsignal::EventFormatter.
|
65
|
+
expect(Appsignal::EventFormatter).to receive(:initialize_formatters)
|
68
66
|
Appsignal.start
|
69
67
|
end
|
70
68
|
|
71
|
-
context "when not active for this environment" do
|
72
|
-
before { Appsignal.config = project_fixture_config("staging") }
|
73
|
-
|
74
|
-
it "should do nothing" do
|
75
|
-
Appsignal.start
|
76
|
-
Appsignal.agent.should be_nil
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
69
|
context "with an extension" do
|
81
70
|
before { Appsignal.extensions << Appsignal::MockExtension }
|
82
71
|
|
83
72
|
it "should call the extension's initializer" do
|
84
|
-
Appsignal::MockExtension.
|
73
|
+
expect(Appsignal::MockExtension).to receive(:initializer)
|
85
74
|
Appsignal.start
|
86
75
|
end
|
87
76
|
end
|
@@ -137,7 +126,7 @@ describe Appsignal do
|
|
137
126
|
end
|
138
127
|
|
139
128
|
it "should start minutely" do
|
140
|
-
Appsignal::Minutely.
|
129
|
+
expect(Appsignal::Minutely).to receive(:start)
|
141
130
|
Appsignal.start
|
142
131
|
end
|
143
132
|
end
|
@@ -148,7 +137,7 @@ describe Appsignal do
|
|
148
137
|
end
|
149
138
|
|
150
139
|
it "should not start minutely" do
|
151
|
-
Appsignal::Minutely.
|
140
|
+
expect(Appsignal::Minutely).to_not receive(:start)
|
152
141
|
Appsignal.start
|
153
142
|
end
|
154
143
|
end
|
@@ -159,7 +148,7 @@ describe Appsignal do
|
|
159
148
|
|
160
149
|
it "should change the log level" do
|
161
150
|
Appsignal.start
|
162
|
-
Appsignal.logger.level.
|
151
|
+
expect(Appsignal.logger.level).to eq Logger::DEBUG
|
163
152
|
end
|
164
153
|
end
|
165
154
|
end
|
@@ -167,7 +156,7 @@ describe Appsignal do
|
|
167
156
|
describe ".forked" do
|
168
157
|
context "when not active" do
|
169
158
|
it "should should do nothing" do
|
170
|
-
Appsignal::Extension.
|
159
|
+
expect(Appsignal::Extension).to_not receive(:start)
|
171
160
|
|
172
161
|
Appsignal.forked
|
173
162
|
end
|
@@ -179,8 +168,8 @@ describe Appsignal do
|
|
179
168
|
end
|
180
169
|
|
181
170
|
it "should resubscribe and start the extension" do
|
182
|
-
Appsignal.
|
183
|
-
Appsignal::Extension.
|
171
|
+
expect(Appsignal).to receive(:start_logger)
|
172
|
+
expect(Appsignal::Extension).to receive(:start)
|
184
173
|
|
185
174
|
Appsignal.forked
|
186
175
|
end
|
@@ -189,18 +178,18 @@ describe Appsignal do
|
|
189
178
|
|
190
179
|
describe ".stop" do
|
191
180
|
it "should call stop on the extension" do
|
192
|
-
Appsignal.logger.
|
193
|
-
Appsignal::Extension.
|
181
|
+
expect(Appsignal.logger).to receive(:debug).with("Stopping appsignal")
|
182
|
+
expect(Appsignal::Extension).to receive(:stop)
|
194
183
|
Appsignal.stop
|
195
|
-
Appsignal.active
|
184
|
+
expect(Appsignal.active?).to be_falsy
|
196
185
|
end
|
197
186
|
|
198
187
|
context "with context specified" do
|
199
188
|
it "should log the context" do
|
200
|
-
Appsignal.logger.
|
201
|
-
Appsignal::Extension.
|
189
|
+
expect(Appsignal.logger).to receive(:debug).with("Stopping appsignal (something)")
|
190
|
+
expect(Appsignal::Extension).to receive(:stop)
|
202
191
|
Appsignal.stop("something")
|
203
|
-
Appsignal.active
|
192
|
+
expect(Appsignal.active?).to be_falsy
|
204
193
|
end
|
205
194
|
end
|
206
195
|
end
|
@@ -213,7 +202,7 @@ describe Appsignal do
|
|
213
202
|
Appsignal.config = nil
|
214
203
|
end
|
215
204
|
|
216
|
-
it {
|
205
|
+
it { is_expected.to be_falsy }
|
217
206
|
end
|
218
207
|
|
219
208
|
context "with inactive config" do
|
@@ -221,7 +210,7 @@ describe Appsignal do
|
|
221
210
|
Appsignal.config = project_fixture_config("nonsense")
|
222
211
|
end
|
223
212
|
|
224
|
-
it {
|
213
|
+
it { is_expected.to be_falsy }
|
225
214
|
end
|
226
215
|
|
227
216
|
context "with active config" do
|
@@ -229,89 +218,88 @@ describe Appsignal do
|
|
229
218
|
Appsignal.config = project_fixture_config
|
230
219
|
end
|
231
220
|
|
232
|
-
it {
|
221
|
+
it { is_expected.to be_truthy }
|
233
222
|
end
|
234
223
|
end
|
235
224
|
|
236
225
|
describe ".add_exception" do
|
237
226
|
it "should alias this method" do
|
238
|
-
Appsignal.
|
227
|
+
expect(Appsignal).to respond_to(:add_exception)
|
239
228
|
end
|
240
229
|
end
|
241
230
|
|
242
231
|
describe ".get_server_state" do
|
243
232
|
it "should call server state on the extension" do
|
244
|
-
Appsignal::Extension.
|
233
|
+
expect(Appsignal::Extension).to receive(:get_server_state).with("key")
|
245
234
|
|
246
235
|
Appsignal.get_server_state("key")
|
247
236
|
end
|
248
237
|
|
249
238
|
it "should get nil by default" do
|
250
|
-
Appsignal.get_server_state("key").
|
239
|
+
expect(Appsignal.get_server_state("key")).to be_nil
|
251
240
|
end
|
252
241
|
end
|
253
242
|
|
254
243
|
context "not active" do
|
255
244
|
describe ".monitor_transaction" do
|
256
245
|
it "should do nothing but still yield the block" do
|
257
|
-
Appsignal::Transaction.
|
258
|
-
Appsignal.
|
246
|
+
expect(Appsignal::Transaction).to_not receive(:create)
|
247
|
+
expect(Appsignal).to_not receive(:instrument)
|
259
248
|
object = double
|
260
|
-
object.
|
249
|
+
expect(object).to receive(:some_method).and_return(1)
|
261
250
|
|
262
|
-
|
263
|
-
Appsignal.monitor_transaction("perform_job.nothing") do
|
251
|
+
expect do
|
252
|
+
expect(Appsignal.monitor_transaction("perform_job.nothing") do
|
264
253
|
object.some_method
|
265
|
-
end.
|
266
|
-
end.
|
254
|
+
end).to eq 1
|
255
|
+
end.to_not raise_error
|
267
256
|
end
|
268
257
|
end
|
269
258
|
|
270
259
|
describe ".listen_for_error" do
|
271
260
|
it "should do nothing" do
|
272
261
|
error = RuntimeError.new("specific error")
|
273
|
-
|
262
|
+
expect do
|
274
263
|
Appsignal.listen_for_error do
|
275
264
|
raise error
|
276
265
|
end
|
277
|
-
end.
|
266
|
+
end.to raise_error(error)
|
278
267
|
end
|
279
268
|
end
|
280
269
|
|
281
270
|
describe ".send_error" do
|
282
271
|
it "should do nothing" do
|
283
|
-
|
272
|
+
expect do
|
284
273
|
Appsignal.send_error(RuntimeError.new)
|
285
|
-
end.
|
274
|
+
end.to_not raise_error
|
286
275
|
end
|
287
276
|
end
|
288
277
|
|
289
278
|
describe ".set_error" do
|
290
279
|
it "should do nothing" do
|
291
|
-
|
280
|
+
expect do
|
292
281
|
Appsignal.set_error(RuntimeError.new)
|
293
|
-
end.
|
282
|
+
end.to_not raise_error
|
294
283
|
end
|
295
284
|
end
|
296
285
|
|
297
286
|
describe ".tag_request" do
|
298
287
|
it "should do nothing" do
|
299
|
-
|
288
|
+
expect do
|
300
289
|
Appsignal.tag_request(:tag => "tag")
|
301
|
-
end.
|
290
|
+
end.to_not raise_error
|
302
291
|
end
|
303
292
|
end
|
304
293
|
|
305
294
|
describe ".instrument" do
|
306
295
|
it "should not instrument, but still call the block" do
|
307
296
|
stub = double
|
308
|
-
stub.
|
297
|
+
expect(stub).to receive(:method_call).and_return("return value")
|
309
298
|
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
end.should_not raise_error
|
299
|
+
return_value = Appsignal.instrument "name" do
|
300
|
+
stub.method_call
|
301
|
+
end
|
302
|
+
expect(return_value).to eq "return value"
|
315
303
|
end
|
316
304
|
end
|
317
305
|
end
|
@@ -325,39 +313,39 @@ describe Appsignal do
|
|
325
313
|
describe ".monitor_transaction" do
|
326
314
|
context "with a successful call" do
|
327
315
|
it "should instrument and complete for a background job" do
|
328
|
-
Appsignal.
|
316
|
+
expect(Appsignal).to receive(:instrument).with(
|
329
317
|
"perform_job.something"
|
330
318
|
).and_yield
|
331
|
-
Appsignal::Transaction.
|
319
|
+
expect(Appsignal::Transaction).to receive(:complete_current!)
|
332
320
|
object = double
|
333
|
-
object.
|
321
|
+
expect(object).to receive(:some_method).and_return(1)
|
334
322
|
|
335
|
-
Appsignal.monitor_transaction(
|
323
|
+
expect(Appsignal.monitor_transaction(
|
336
324
|
"perform_job.something",
|
337
325
|
background_env_with_data
|
338
326
|
) do
|
339
327
|
current = Appsignal::Transaction.current
|
340
|
-
current.namespace.
|
341
|
-
current.request.
|
328
|
+
expect(current.namespace).to eq Appsignal::Transaction::BACKGROUND_JOB
|
329
|
+
expect(current.request).to be_a(Appsignal::Transaction::GenericRequest)
|
342
330
|
object.some_method
|
343
|
-
end.
|
331
|
+
end).to eq 1
|
344
332
|
end
|
345
333
|
|
346
334
|
it "should instrument and complete for a http request" do
|
347
|
-
Appsignal.
|
335
|
+
expect(Appsignal).to receive(:instrument).with(
|
348
336
|
"process_action.something"
|
349
337
|
).and_yield
|
350
|
-
Appsignal::Transaction.
|
338
|
+
expect(Appsignal::Transaction).to receive(:complete_current!)
|
351
339
|
object = double
|
352
|
-
object.
|
340
|
+
expect(object).to receive(:some_method)
|
353
341
|
|
354
342
|
Appsignal.monitor_transaction(
|
355
343
|
"process_action.something",
|
356
344
|
http_request_env_with_data
|
357
345
|
) do
|
358
346
|
current = Appsignal::Transaction.current
|
359
|
-
current.namespace.
|
360
|
-
current.request.
|
347
|
+
expect(current.namespace).to eq Appsignal::Transaction::HTTP_REQUEST
|
348
|
+
expect(current.request).to be_a(::Rack::Request)
|
361
349
|
object.some_method
|
362
350
|
end
|
363
351
|
end
|
@@ -367,14 +355,14 @@ describe Appsignal do
|
|
367
355
|
let(:error) { VerySpecificError.new }
|
368
356
|
|
369
357
|
it "should add the error to the current transaction and complete" do
|
370
|
-
Appsignal::Transaction.
|
371
|
-
Appsignal::Transaction.
|
358
|
+
expect_any_instance_of(Appsignal::Transaction).to receive(:set_error).with(error)
|
359
|
+
expect(Appsignal::Transaction).to receive(:complete_current!)
|
372
360
|
|
373
|
-
|
361
|
+
expect do
|
374
362
|
Appsignal.monitor_transaction("perform_job.something") do
|
375
363
|
raise error
|
376
364
|
end
|
377
|
-
end.
|
365
|
+
end.to raise_error(error)
|
378
366
|
end
|
379
367
|
end
|
380
368
|
end
|
@@ -382,11 +370,11 @@ describe Appsignal do
|
|
382
370
|
describe ".monitor_single_transaction" do
|
383
371
|
context "with a successful call" do
|
384
372
|
it "should call monitor_transaction and stop" do
|
385
|
-
Appsignal.
|
373
|
+
expect(Appsignal).to receive(:monitor_transaction).with(
|
386
374
|
"perform_job.something",
|
387
375
|
:key => :value
|
388
376
|
).and_yield
|
389
|
-
Appsignal.
|
377
|
+
expect(Appsignal).to receive(:stop)
|
390
378
|
|
391
379
|
Appsignal.monitor_single_transaction("perform_job.something", :key => :value) do
|
392
380
|
# nothing
|
@@ -398,28 +386,28 @@ describe Appsignal do
|
|
398
386
|
let(:error) { VerySpecificError.new }
|
399
387
|
|
400
388
|
it "should call monitor_transaction and stop and then raise the error" do
|
401
|
-
Appsignal.
|
389
|
+
expect(Appsignal).to receive(:monitor_transaction).with(
|
402
390
|
"perform_job.something",
|
403
391
|
:key => :value
|
404
392
|
).and_yield
|
405
|
-
Appsignal.
|
393
|
+
expect(Appsignal).to receive(:stop)
|
406
394
|
|
407
|
-
|
395
|
+
expect do
|
408
396
|
Appsignal.monitor_single_transaction("perform_job.something", :key => :value) do
|
409
397
|
raise error
|
410
398
|
end
|
411
|
-
end.
|
399
|
+
end.to raise_error(error)
|
412
400
|
end
|
413
401
|
end
|
414
402
|
end
|
415
403
|
|
416
404
|
describe ".tag_request" do
|
417
|
-
before { Appsignal::Transaction.
|
405
|
+
before { allow(Appsignal::Transaction).to receive(:current).and_return(transaction) }
|
418
406
|
|
419
407
|
context "with transaction" do
|
420
408
|
let(:transaction) { double }
|
421
409
|
it "should call set_tags on transaction" do
|
422
|
-
transaction.
|
410
|
+
expect(transaction).to receive(:set_tags).with("a" => "b")
|
423
411
|
end
|
424
412
|
|
425
413
|
after { Appsignal.tag_request("a" => "b") }
|
@@ -429,118 +417,118 @@ describe Appsignal do
|
|
429
417
|
let(:transaction) { nil }
|
430
418
|
|
431
419
|
it "should call set_tags on transaction" do
|
432
|
-
Appsignal.tag_request.
|
420
|
+
expect(Appsignal.tag_request).to be_falsy
|
433
421
|
end
|
434
422
|
end
|
435
423
|
|
436
424
|
it "should also listen to tag_job" do
|
437
|
-
Appsignal.
|
425
|
+
expect(Appsignal).to respond_to(:tag_job)
|
438
426
|
end
|
439
427
|
end
|
440
428
|
|
441
429
|
describe "custom stats" do
|
442
430
|
describe ".set_gauge" do
|
443
431
|
it "should call set_gauge on the extension with a string key and float" do
|
444
|
-
Appsignal::Extension.
|
432
|
+
expect(Appsignal::Extension).to receive(:set_gauge).with("key", 0.1)
|
445
433
|
Appsignal.set_gauge("key", 0.1)
|
446
434
|
end
|
447
435
|
|
448
436
|
it "should call set_gauge on the extension with a symbol key and int" do
|
449
|
-
Appsignal::Extension.
|
437
|
+
expect(Appsignal::Extension).to receive(:set_gauge).with("key", 1.0)
|
450
438
|
Appsignal.set_gauge(:key, 1)
|
451
439
|
end
|
452
440
|
|
453
441
|
it "should not raise an exception when out of range" do
|
454
|
-
Appsignal::Extension.
|
455
|
-
Appsignal.logger.
|
456
|
-
|
442
|
+
expect(Appsignal::Extension).to receive(:set_gauge).with("key", 10).and_raise(RangeError)
|
443
|
+
expect(Appsignal.logger).to receive(:warn).with("Gauge value 10 for key 'key' is too big")
|
444
|
+
expect do
|
457
445
|
Appsignal.set_gauge("key", 10)
|
458
|
-
end.
|
446
|
+
end.to_not raise_error
|
459
447
|
end
|
460
448
|
end
|
461
449
|
|
462
450
|
describe ".set_host_gauge" do
|
463
451
|
it "should call set_host_gauge on the extension with a string key and float" do
|
464
|
-
Appsignal::Extension.
|
452
|
+
expect(Appsignal::Extension).to receive(:set_host_gauge).with("key", 0.1)
|
465
453
|
Appsignal.set_host_gauge("key", 0.1)
|
466
454
|
end
|
467
455
|
|
468
456
|
it "should call set_host_gauge on the extension with a symbol key and int" do
|
469
|
-
Appsignal::Extension.
|
457
|
+
expect(Appsignal::Extension).to receive(:set_host_gauge).with("key", 1.0)
|
470
458
|
Appsignal.set_host_gauge(:key, 1)
|
471
459
|
end
|
472
460
|
|
473
461
|
it "should not raise an exception when out of range" do
|
474
|
-
Appsignal::Extension.
|
475
|
-
Appsignal.logger.
|
476
|
-
|
462
|
+
expect(Appsignal::Extension).to receive(:set_host_gauge).with("key", 10).and_raise(RangeError)
|
463
|
+
expect(Appsignal.logger).to receive(:warn).with("Host gauge value 10 for key 'key' is too big")
|
464
|
+
expect do
|
477
465
|
Appsignal.set_host_gauge("key", 10)
|
478
|
-
end.
|
466
|
+
end.to_not raise_error
|
479
467
|
end
|
480
468
|
end
|
481
469
|
|
482
470
|
describe ".set_process_gauge" do
|
483
471
|
it "should call set_process_gauge on the extension with a string key and float" do
|
484
|
-
Appsignal::Extension.
|
472
|
+
expect(Appsignal::Extension).to receive(:set_process_gauge).with("key", 0.1)
|
485
473
|
Appsignal.set_process_gauge("key", 0.1)
|
486
474
|
end
|
487
475
|
|
488
476
|
it "should call set_process_gauge on the extension with a symbol key and int" do
|
489
|
-
Appsignal::Extension.
|
477
|
+
expect(Appsignal::Extension).to receive(:set_process_gauge).with("key", 1.0)
|
490
478
|
Appsignal.set_process_gauge(:key, 1)
|
491
479
|
end
|
492
480
|
|
493
481
|
it "should not raise an exception when out of range" do
|
494
|
-
Appsignal::Extension.
|
495
|
-
Appsignal.logger.
|
496
|
-
|
482
|
+
expect(Appsignal::Extension).to receive(:set_process_gauge).with("key", 10).and_raise(RangeError)
|
483
|
+
expect(Appsignal.logger).to receive(:warn).with("Process gauge value 10 for key 'key' is too big")
|
484
|
+
expect do
|
497
485
|
Appsignal.set_process_gauge("key", 10)
|
498
|
-
end.
|
486
|
+
end.to_not raise_error
|
499
487
|
end
|
500
488
|
end
|
501
489
|
|
502
490
|
describe ".increment_counter" do
|
503
491
|
it "should call increment_counter on the extension with a string key" do
|
504
|
-
Appsignal::Extension.
|
492
|
+
expect(Appsignal::Extension).to receive(:increment_counter).with("key", 1)
|
505
493
|
Appsignal.increment_counter("key")
|
506
494
|
end
|
507
495
|
|
508
496
|
it "should call increment_counter on the extension with a symbol key" do
|
509
|
-
Appsignal::Extension.
|
497
|
+
expect(Appsignal::Extension).to receive(:increment_counter).with("key", 1)
|
510
498
|
Appsignal.increment_counter(:key)
|
511
499
|
end
|
512
500
|
|
513
501
|
it "should call increment_counter on the extension with a count" do
|
514
|
-
Appsignal::Extension.
|
502
|
+
expect(Appsignal::Extension).to receive(:increment_counter).with("key", 5)
|
515
503
|
Appsignal.increment_counter("key", 5)
|
516
504
|
end
|
517
505
|
|
518
506
|
it "should not raise an exception when out of range" do
|
519
|
-
Appsignal::Extension.
|
520
|
-
Appsignal.logger.
|
521
|
-
|
507
|
+
expect(Appsignal::Extension).to receive(:increment_counter).with("key", 10).and_raise(RangeError)
|
508
|
+
expect(Appsignal.logger).to receive(:warn).with("Counter value 10 for key 'key' is too big")
|
509
|
+
expect do
|
522
510
|
Appsignal.increment_counter("key", 10)
|
523
|
-
end.
|
511
|
+
end.to_not raise_error
|
524
512
|
end
|
525
513
|
end
|
526
514
|
|
527
515
|
describe ".add_distribution_value" do
|
528
516
|
it "should call add_distribution_value on the extension with a string key and float" do
|
529
|
-
Appsignal::Extension.
|
517
|
+
expect(Appsignal::Extension).to receive(:add_distribution_value).with("key", 0.1)
|
530
518
|
Appsignal.add_distribution_value("key", 0.1)
|
531
519
|
end
|
532
520
|
|
533
521
|
it "should call add_distribution_value on the extension with a symbol key and int" do
|
534
|
-
Appsignal::Extension.
|
522
|
+
expect(Appsignal::Extension).to receive(:add_distribution_value).with("key", 1.0)
|
535
523
|
Appsignal.add_distribution_value(:key, 1)
|
536
524
|
end
|
537
525
|
|
538
526
|
it "should not raise an exception when out of range" do
|
539
|
-
Appsignal::Extension.
|
540
|
-
Appsignal.logger.
|
541
|
-
|
527
|
+
expect(Appsignal::Extension).to receive(:add_distribution_value).with("key", 10).and_raise(RangeError)
|
528
|
+
expect(Appsignal.logger).to receive(:warn).with("Distribution value 10 for key 'key' is too big")
|
529
|
+
expect do
|
542
530
|
Appsignal.add_distribution_value("key", 10)
|
543
|
-
end.
|
531
|
+
end.to_not raise_error
|
544
532
|
end
|
545
533
|
end
|
546
534
|
end
|
@@ -548,7 +536,7 @@ describe Appsignal do
|
|
548
536
|
describe ".logger" do
|
549
537
|
subject { Appsignal.logger }
|
550
538
|
|
551
|
-
it {
|
539
|
+
it { is_expected.to be_a Logger }
|
552
540
|
end
|
553
541
|
|
554
542
|
describe ".start_logger" do
|
@@ -581,7 +569,7 @@ describe Appsignal do
|
|
581
569
|
end
|
582
570
|
|
583
571
|
it "logs to file" do
|
584
|
-
expect(File.exist?(log_file)).to
|
572
|
+
expect(File.exist?(log_file)).to be_truthy
|
585
573
|
expect(log_file_contents).to include "[ERROR] Log to file"
|
586
574
|
expect(output).to be_empty
|
587
575
|
end
|
@@ -603,7 +591,7 @@ describe Appsignal do
|
|
603
591
|
end
|
604
592
|
|
605
593
|
it "logs to stdout" do
|
606
|
-
expect(File.writable?(log_file)).to
|
594
|
+
expect(File.writable?(log_file)).to be_falsy
|
607
595
|
expect(output).to include "[ERROR] appsignal: Log to not writable log file"
|
608
596
|
end
|
609
597
|
|
@@ -634,7 +622,7 @@ describe Appsignal do
|
|
634
622
|
end
|
635
623
|
|
636
624
|
it "logs to stdout" do
|
637
|
-
expect(File.writable?(log_path)).to
|
625
|
+
expect(File.writable?(log_path)).to be_falsy
|
638
626
|
expect(output).to include "[ERROR] appsignal: Log to not writable log path"
|
639
627
|
end
|
640
628
|
|
@@ -722,9 +710,9 @@ describe Appsignal do
|
|
722
710
|
describe ".config" do
|
723
711
|
subject { Appsignal.config }
|
724
712
|
|
725
|
-
it {
|
713
|
+
it { is_expected.to be_a Appsignal::Config }
|
726
714
|
it "should return configuration" do
|
727
|
-
subject[:endpoint].
|
715
|
+
expect(subject[:endpoint]).to eq "https://push.appsignal.com"
|
728
716
|
end
|
729
717
|
end
|
730
718
|
|
@@ -733,7 +721,7 @@ describe Appsignal do
|
|
733
721
|
let(:error) { VerySpecificError.new }
|
734
722
|
|
735
723
|
it "should send the error to AppSignal" do
|
736
|
-
Appsignal::Transaction.
|
724
|
+
expect(Appsignal::Transaction).to receive(:new).and_call_original
|
737
725
|
end
|
738
726
|
|
739
727
|
context "with tags" do
|
@@ -745,9 +733,9 @@ describe Appsignal do
|
|
745
733
|
Appsignal::Transaction::HTTP_REQUEST,
|
746
734
|
Appsignal::Transaction::GenericRequest.new({})
|
747
735
|
)
|
748
|
-
Appsignal::Transaction.
|
749
|
-
transaction.
|
750
|
-
transaction.
|
736
|
+
allow(Appsignal::Transaction).to receive(:new).and_return(transaction)
|
737
|
+
expect(transaction).to receive(:set_tags).with(tags)
|
738
|
+
expect(transaction).to receive(:complete)
|
751
739
|
end
|
752
740
|
end
|
753
741
|
|
@@ -770,35 +758,35 @@ describe Appsignal do
|
|
770
758
|
|
771
759
|
describe ".listen_for_error" do
|
772
760
|
it "should call send_error and re-raise" do
|
773
|
-
Appsignal.
|
774
|
-
|
761
|
+
expect(Appsignal).to receive(:send_error).with(kind_of(Exception))
|
762
|
+
expect do
|
775
763
|
Appsignal.listen_for_error do
|
776
764
|
raise "I am an exception"
|
777
765
|
end
|
778
|
-
end.
|
766
|
+
end.to raise_error(RuntimeError, "I am an exception")
|
779
767
|
end
|
780
768
|
end
|
781
769
|
|
782
770
|
describe ".set_error" do
|
783
|
-
before { Appsignal::Transaction.
|
771
|
+
before { allow(Appsignal::Transaction).to receive(:current).and_return(transaction) }
|
784
772
|
let(:error) { RuntimeError.new("I am an exception") }
|
785
773
|
|
786
774
|
it "should add the error to the current transaction" do
|
787
|
-
transaction.
|
775
|
+
expect(transaction).to receive(:set_error).with(error)
|
788
776
|
|
789
777
|
Appsignal.set_error(error)
|
790
778
|
end
|
791
779
|
|
792
780
|
it "should do nothing if there is no current transaction" do
|
793
|
-
Appsignal::Transaction.
|
781
|
+
allow(Appsignal::Transaction).to receive(:current).and_return(nil)
|
794
782
|
|
795
|
-
transaction.
|
783
|
+
expect(transaction).to_not receive(:set_error)
|
796
784
|
|
797
785
|
Appsignal.set_error(error)
|
798
786
|
end
|
799
787
|
|
800
788
|
it "should do nothing if the error is nil" do
|
801
|
-
transaction.
|
789
|
+
expect(transaction).to_not receive(:set_error)
|
802
790
|
|
803
791
|
Appsignal.set_error(nil)
|
804
792
|
end
|
@@ -840,11 +828,11 @@ describe Appsignal do
|
|
840
828
|
|
841
829
|
describe ".without_instrumentation" do
|
842
830
|
let(:transaction) { double }
|
843
|
-
before { Appsignal::Transaction.
|
831
|
+
before { allow(Appsignal::Transaction).to receive(:current).and_return(transaction) }
|
844
832
|
|
845
833
|
it "should pause and unpause the transaction around the block" do
|
846
|
-
transaction.
|
847
|
-
transaction.
|
834
|
+
expect(transaction).to receive(:pause!)
|
835
|
+
expect(transaction).to receive(:resume!)
|
848
836
|
end
|
849
837
|
|
850
838
|
context "without transaction" do
|
@@ -867,9 +855,7 @@ describe Appsignal do
|
|
867
855
|
let(:err_stream) { std_stream }
|
868
856
|
let(:stderr) { err_stream.read }
|
869
857
|
before do
|
870
|
-
Appsignal.
|
871
|
-
:config => { :ignore_errors => ["StandardError"] }
|
872
|
-
)
|
858
|
+
allow(Appsignal).to receive(:config).and_return(:ignore_errors => ["StandardError"])
|
873
859
|
end
|
874
860
|
|
875
861
|
subject do
|
@@ -879,7 +865,7 @@ describe Appsignal do
|
|
879
865
|
end
|
880
866
|
|
881
867
|
it "should return true if it's in the ignored list" do
|
882
|
-
|
868
|
+
is_expected.to be_truthy
|
883
869
|
end
|
884
870
|
|
885
871
|
it "outputs deprecated warning" do
|
@@ -891,7 +877,7 @@ describe Appsignal do
|
|
891
877
|
let(:error) { Object.new }
|
892
878
|
|
893
879
|
it "should return false" do
|
894
|
-
|
880
|
+
is_expected.to be_falsy
|
895
881
|
end
|
896
882
|
end
|
897
883
|
end
|
@@ -901,9 +887,7 @@ describe Appsignal do
|
|
901
887
|
let(:err_stream) { std_stream }
|
902
888
|
let(:stderr) { err_stream.read }
|
903
889
|
before do
|
904
|
-
Appsignal.
|
905
|
-
:config => { :ignore_actions => "TestController#isup" }
|
906
|
-
)
|
890
|
+
allow(Appsignal).to receive(:config).and_return(:ignore_actions => "TestController#isup")
|
907
891
|
end
|
908
892
|
|
909
893
|
subject do
|
@@ -913,7 +897,7 @@ describe Appsignal do
|
|
913
897
|
end
|
914
898
|
|
915
899
|
it "should return true if it's in the ignored list" do
|
916
|
-
|
900
|
+
is_expected.to be_truthy
|
917
901
|
end
|
918
902
|
|
919
903
|
it "outputs deprecated warning" do
|
@@ -925,7 +909,7 @@ describe Appsignal do
|
|
925
909
|
let(:action) { "TestController#other_action" }
|
926
910
|
|
927
911
|
it "should return false" do
|
928
|
-
|
912
|
+
is_expected.to be_falsy
|
929
913
|
end
|
930
914
|
end
|
931
915
|
end
|