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,7 +11,7 @@ describe Appsignal::Demo do
|
|
11
11
|
|
12
12
|
context "without config" do
|
13
13
|
it "returns false" do
|
14
|
-
expect(silence { subject }).to
|
14
|
+
expect(silence { subject }).to be_falsy
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
@@ -20,7 +20,7 @@ describe Appsignal::Demo do
|
|
20
20
|
before { Appsignal.config = config }
|
21
21
|
|
22
22
|
it "returns true" do
|
23
|
-
expect(subject).to
|
23
|
+
expect(subject).to be_truthy
|
24
24
|
end
|
25
25
|
|
26
26
|
it "creates demonstration samples" do
|
@@ -50,6 +50,7 @@ describe Appsignal::Demo do
|
|
50
50
|
expect(error_transaction).to receive(:set_metadata).with("path", "/hello")
|
51
51
|
expect(error_transaction).to receive(:set_metadata).with("method", "GET")
|
52
52
|
expect(error_transaction).to receive(:set_metadata).with("demo_sample", "true")
|
53
|
+
expect(error_transaction).to receive(:complete)
|
53
54
|
subject
|
54
55
|
end
|
55
56
|
end
|
@@ -79,6 +80,7 @@ describe Appsignal::Demo do
|
|
79
80
|
expect(performance_transaction).to receive(:set_metadata).with("path", "/hello")
|
80
81
|
expect(performance_transaction).to receive(:set_metadata).with("method", "GET")
|
81
82
|
expect(performance_transaction).to receive(:set_metadata).with("demo_sample", "true")
|
83
|
+
expect(performance_transaction).to receive(:complete)
|
82
84
|
subject
|
83
85
|
end
|
84
86
|
end
|
@@ -2,17 +2,21 @@ if DependencyHelper.rails_present?
|
|
2
2
|
require "action_view"
|
3
3
|
|
4
4
|
describe Appsignal::EventFormatter::ActionView::RenderFormatter do
|
5
|
-
before { Rails.root.
|
5
|
+
before { allow(Rails.root).to receive(:to_s).and_return("/var/www/app/20130101") }
|
6
6
|
let(:klass) { Appsignal::EventFormatter::ActionView::RenderFormatter }
|
7
7
|
let(:formatter) { klass.new }
|
8
8
|
|
9
9
|
it "should register render_partial.action_view and render_template.action_view" do
|
10
|
-
Appsignal::EventFormatter.registered?("render_partial.action_view", klass).
|
11
|
-
Appsignal::EventFormatter.registered?("render_template.action_view", klass).
|
10
|
+
expect(Appsignal::EventFormatter.registered?("render_partial.action_view", klass)).to be_truthy
|
11
|
+
expect(Appsignal::EventFormatter.registered?("render_template.action_view", klass)).to be_truthy
|
12
12
|
end
|
13
13
|
|
14
14
|
describe "#root_path" do
|
15
|
-
|
15
|
+
subject { formatter.root_path }
|
16
|
+
|
17
|
+
it "returns Rails root path" do
|
18
|
+
is_expected.to eq "/var/www/app/20130101/"
|
19
|
+
end
|
16
20
|
end
|
17
21
|
|
18
22
|
describe "#format" do
|
@@ -21,19 +25,19 @@ if DependencyHelper.rails_present?
|
|
21
25
|
context "with an identifier" do
|
22
26
|
let(:payload) { { :identifier => "/var/www/app/20130101/app/views/home/index/html.erb" } }
|
23
27
|
|
24
|
-
it {
|
28
|
+
it { is_expected.to eq ["app/views/home/index/html.erb", nil] }
|
25
29
|
end
|
26
30
|
|
27
31
|
context "with a frozen identifier" do
|
28
32
|
let(:payload) { { :identifier => "/var/www/app/20130101/app/views/home/index/html.erb".freeze } }
|
29
33
|
|
30
|
-
it {
|
34
|
+
it { is_expected.to eq ["app/views/home/index/html.erb", nil] }
|
31
35
|
end
|
32
36
|
|
33
37
|
context "without an identifier" do
|
34
38
|
let(:payload) { {} }
|
35
39
|
|
36
|
-
it {
|
40
|
+
it { is_expected.to be_nil }
|
37
41
|
end
|
38
42
|
end
|
39
43
|
end
|
@@ -3,7 +3,7 @@ describe Appsignal::EventFormatter::ActiveRecord::InstantiationFormatter do
|
|
3
3
|
let(:formatter) { klass.new }
|
4
4
|
|
5
5
|
it "should register instantiation.active_record" do
|
6
|
-
Appsignal::EventFormatter.registered?("instantiation.active_record", klass).
|
6
|
+
expect(Appsignal::EventFormatter.registered?("instantiation.active_record", klass)).to be_truthy
|
7
7
|
end
|
8
8
|
|
9
9
|
describe "#format" do
|
@@ -16,6 +16,6 @@ describe Appsignal::EventFormatter::ActiveRecord::InstantiationFormatter do
|
|
16
16
|
|
17
17
|
subject { formatter.format(payload) }
|
18
18
|
|
19
|
-
it {
|
19
|
+
it { is_expected.to eq ["User", nil] }
|
20
20
|
end
|
21
21
|
end
|
@@ -3,7 +3,7 @@ describe Appsignal::EventFormatter::ActiveRecord::InstantiationFormatter do
|
|
3
3
|
let(:formatter) { klass.new }
|
4
4
|
|
5
5
|
it "should register sql.active_record" do
|
6
|
-
Appsignal::EventFormatter.registered?("sql.active_record", klass).
|
6
|
+
expect(Appsignal::EventFormatter.registered?("sql.active_record", klass)).to be_truthy
|
7
7
|
end
|
8
8
|
|
9
9
|
describe "#format" do
|
@@ -16,6 +16,6 @@ describe Appsignal::EventFormatter::ActiveRecord::InstantiationFormatter do
|
|
16
16
|
|
17
17
|
subject { formatter.format(payload) }
|
18
18
|
|
19
|
-
it {
|
19
|
+
it { is_expected.to eq ["User load", "SELECT * FROM users", 1] }
|
20
20
|
end
|
21
21
|
end
|
@@ -3,7 +3,7 @@ describe Appsignal::EventFormatter::Faraday::RequestFormatter do
|
|
3
3
|
let(:formatter) { klass.new }
|
4
4
|
|
5
5
|
it "should register request.faraday" do
|
6
|
-
Appsignal::EventFormatter.registered?("request.faraday", klass).
|
6
|
+
expect(Appsignal::EventFormatter.registered?("request.faraday", klass)).to be_truthy
|
7
7
|
end
|
8
8
|
|
9
9
|
describe "#format" do
|
@@ -16,6 +16,6 @@ describe Appsignal::EventFormatter::Faraday::RequestFormatter do
|
|
16
16
|
|
17
17
|
subject { formatter.format(payload) }
|
18
18
|
|
19
|
-
it {
|
19
|
+
it { is_expected.to eq ["GET http://example.org", "GET http://example.org/hello/world"] }
|
20
20
|
end
|
21
21
|
end
|
@@ -3,7 +3,7 @@ describe Appsignal::EventFormatter::Moped::QueryFormatter do
|
|
3
3
|
let(:formatter) { klass.new }
|
4
4
|
|
5
5
|
it "should register query.moped" do
|
6
|
-
Appsignal::EventFormatter.registered?("query.moped", klass).
|
6
|
+
expect(Appsignal::EventFormatter.registered?("query.moped", klass)).to be_truthy
|
7
7
|
end
|
8
8
|
|
9
9
|
describe "#format" do
|
@@ -13,7 +13,7 @@ describe Appsignal::EventFormatter::Moped::QueryFormatter do
|
|
13
13
|
context "without ops in the payload" do
|
14
14
|
let(:payload) { {} }
|
15
15
|
|
16
|
-
it {
|
16
|
+
it { is_expected.to be_nil }
|
17
17
|
end
|
18
18
|
|
19
19
|
context "Moped::Protocol::Command" do
|
@@ -25,7 +25,7 @@ describe Appsignal::EventFormatter::Moped::QueryFormatter do
|
|
25
25
|
)
|
26
26
|
end
|
27
27
|
|
28
|
-
it {
|
28
|
+
it { is_expected.to eq ["Command", '{:database=>"database.collection", :selector=>{"query"=>"?"}}'] }
|
29
29
|
end
|
30
30
|
|
31
31
|
context "Moped::Protocol::Query" do
|
@@ -41,7 +41,7 @@ describe Appsignal::EventFormatter::Moped::QueryFormatter do
|
|
41
41
|
)
|
42
42
|
end
|
43
43
|
|
44
|
-
it {
|
44
|
+
it { is_expected.to eq ["Query", '{:database=>"database.collection", :selector=>{"_id"=>"?"}, :flags=>[], :limit=>0, :skip=>0, :fields=>nil}'] }
|
45
45
|
end
|
46
46
|
|
47
47
|
context "Moped::Protocol::Delete" do
|
@@ -54,7 +54,7 @@ describe Appsignal::EventFormatter::Moped::QueryFormatter do
|
|
54
54
|
)
|
55
55
|
end
|
56
56
|
|
57
|
-
it {
|
57
|
+
it { is_expected.to eq ["Delete", '{:database=>"database.collection", :selector=>{"_id"=>"?"}, :flags=>[]}'] }
|
58
58
|
end
|
59
59
|
|
60
60
|
context "Moped::Protocol::Insert" do
|
@@ -70,7 +70,7 @@ describe Appsignal::EventFormatter::Moped::QueryFormatter do
|
|
70
70
|
)
|
71
71
|
end
|
72
72
|
|
73
|
-
it {
|
73
|
+
it { is_expected.to eq ["Insert", '{:database=>"database.collection", :documents=>{"_id"=>"?", "events"=>"?"}, :count=>2, :flags=>[]}'] }
|
74
74
|
end
|
75
75
|
|
76
76
|
context "Moped::Protocol::Update" do
|
@@ -84,7 +84,7 @@ describe Appsignal::EventFormatter::Moped::QueryFormatter do
|
|
84
84
|
)
|
85
85
|
end
|
86
86
|
|
87
|
-
it {
|
87
|
+
it { is_expected.to eq ["Update", '{:database=>"database.collection", :selector=>{"_id"=>"?"}, :update=>{"user.?"=>"?"}, :flags=>[]}'] }
|
88
88
|
end
|
89
89
|
|
90
90
|
context "Moped::Protocol::KillCursors" do
|
@@ -95,7 +95,7 @@ describe Appsignal::EventFormatter::Moped::QueryFormatter do
|
|
95
95
|
)
|
96
96
|
end
|
97
97
|
|
98
|
-
it {
|
98
|
+
it { is_expected.to eq ["KillCursors", "{:number_of_cursor_ids=>2}"] }
|
99
99
|
end
|
100
100
|
|
101
101
|
context "Moped::Protocol::Other" do
|
@@ -106,7 +106,7 @@ describe Appsignal::EventFormatter::Moped::QueryFormatter do
|
|
106
106
|
)
|
107
107
|
end
|
108
108
|
|
109
|
-
it {
|
109
|
+
it { is_expected.to eq ["Other", '{:database=>"database.collection"}'] }
|
110
110
|
end
|
111
111
|
end
|
112
112
|
end
|
@@ -39,18 +39,18 @@ describe Appsignal::EventFormatter do
|
|
39
39
|
|
40
40
|
context "registering and unregistering formatters" do
|
41
41
|
it "should register a formatter" do
|
42
|
-
klass.formatters["mock"].
|
42
|
+
expect(klass.formatters["mock"]).to be_instance_of(MockFormatter)
|
43
43
|
end
|
44
44
|
|
45
45
|
it "should know wether a formatter is registered" do
|
46
|
-
klass.registered?("mock").
|
47
|
-
klass.registered?("mock", MockFormatter).
|
48
|
-
klass.registered?("mock", Hash).
|
49
|
-
klass.registered?("nonsense").
|
46
|
+
expect(klass.registered?("mock")).to be_truthy
|
47
|
+
expect(klass.registered?("mock", MockFormatter)).to be_truthy
|
48
|
+
expect(klass.registered?("mock", Hash)).to be_falsy
|
49
|
+
expect(klass.registered?("nonsense")).to be_falsy
|
50
50
|
end
|
51
51
|
|
52
52
|
it "doesn't register formatters that raise a name error in the initializer" do
|
53
|
-
klass.registered?("mock.dependent").
|
53
|
+
expect(klass.registered?("mock.dependent")).to be_falsy
|
54
54
|
end
|
55
55
|
|
56
56
|
it "doesn't register formatters that don't have a format(payload) method" do
|
@@ -59,42 +59,42 @@ describe Appsignal::EventFormatter do
|
|
59
59
|
|
60
60
|
Appsignal::EventFormatter.initialize_formatters
|
61
61
|
|
62
|
-
klass.registered?("mock.missing_format").
|
63
|
-
klass.registered?("mock.incorrect_format").
|
62
|
+
expect(klass.registered?("mock.missing_format")).to be_falsy
|
63
|
+
expect(klass.registered?("mock.incorrect_format")).to be_falsy
|
64
64
|
end
|
65
65
|
|
66
66
|
it "should register a custom formatter" do
|
67
67
|
klass.register("mock.specific", MockFormatter)
|
68
68
|
Appsignal::EventFormatter.initialize_formatters
|
69
69
|
|
70
|
-
klass.formatter_classes["mock.specific"].
|
71
|
-
klass.registered?("mock.specific").
|
72
|
-
klass.formatters["mock.specific"].
|
73
|
-
klass.formatters["mock.specific"].body.
|
70
|
+
expect(klass.formatter_classes["mock.specific"]).to eq MockFormatter
|
71
|
+
expect(klass.registered?("mock.specific")).to be_truthy
|
72
|
+
expect(klass.formatters["mock.specific"]).to be_instance_of(MockFormatter)
|
73
|
+
expect(klass.formatters["mock.specific"].body).to eq "some value"
|
74
74
|
end
|
75
75
|
|
76
76
|
it "should not have a formatter that's not registered" do
|
77
|
-
klass.formatters["nonsense"].
|
77
|
+
expect(klass.formatters["nonsense"]).to be_nil
|
78
78
|
end
|
79
79
|
|
80
80
|
it "should unregister a formatter if the registered one has the same class" do
|
81
81
|
klass.register("mock.unregister", MockFormatter)
|
82
82
|
|
83
83
|
klass.unregister("mock.unregister", Hash)
|
84
|
-
klass.registered?("mock.unregister").
|
84
|
+
expect(klass.registered?("mock.unregister")).to be_truthy
|
85
85
|
|
86
86
|
klass.unregister("mock.unregister", MockFormatter)
|
87
|
-
klass.registered?("mock.unregister").
|
87
|
+
expect(klass.registered?("mock.unregister")).to be_falsy
|
88
88
|
end
|
89
89
|
end
|
90
90
|
|
91
91
|
context "calling formatters" do
|
92
92
|
it "should return nil if there is no formatter registered" do
|
93
|
-
klass.format("nonsense", {}).
|
93
|
+
expect(klass.format("nonsense", {})).to be_nil
|
94
94
|
end
|
95
95
|
|
96
96
|
it "should call the formatter if it is registered and use a value set in the initializer" do
|
97
|
-
klass.format("mock", {}).
|
97
|
+
expect(klass.format("mock", {})).to eq ["title", "some value"]
|
98
98
|
end
|
99
99
|
end
|
100
100
|
end
|
@@ -4,21 +4,21 @@ describe "extension loading and operation" do
|
|
4
4
|
describe ".agent_config" do
|
5
5
|
subject { Appsignal::Extension.agent_config }
|
6
6
|
|
7
|
-
it {
|
8
|
-
it {
|
7
|
+
it { is_expected.to have_key("version") }
|
8
|
+
it { is_expected.to have_key("triples") }
|
9
9
|
end
|
10
10
|
|
11
11
|
describe ".agent_version" do
|
12
12
|
subject { Appsignal::Extension.agent_version }
|
13
13
|
|
14
|
-
it {
|
14
|
+
it { is_expected.to_not be_nil }
|
15
15
|
end
|
16
16
|
|
17
17
|
context "when the extension library can be loaded" do
|
18
18
|
subject { Appsignal::Extension }
|
19
19
|
|
20
20
|
it "should indicate that the extension is loaded" do
|
21
|
-
Appsignal.extension_loaded
|
21
|
+
expect(Appsignal.extension_loaded?).to be_truthy
|
22
22
|
end
|
23
23
|
|
24
24
|
it "should have a start and stop method" do
|
@@ -97,15 +97,15 @@ describe "extension loading and operation" do
|
|
97
97
|
context "when the extension library cannot be loaded" do
|
98
98
|
subject { Appsignal::Extension }
|
99
99
|
|
100
|
-
before :
|
100
|
+
before :context do
|
101
101
|
Appsignal.extension_loaded = false
|
102
102
|
end
|
103
|
-
after :
|
103
|
+
after :context do
|
104
104
|
Appsignal.extension_loaded = true
|
105
105
|
end
|
106
106
|
|
107
107
|
it "should indicate that the extension is not loaded" do
|
108
|
-
Appsignal.extension_loaded
|
108
|
+
expect(Appsignal.extension_loaded?).to be_falsy
|
109
109
|
end
|
110
110
|
|
111
111
|
it "should not raise errors when methods are called" do
|
@@ -1,6 +1,6 @@
|
|
1
1
|
describe Appsignal::Hooks::ActiveSupportNotificationsHook do
|
2
2
|
if active_support_present?
|
3
|
-
before :
|
3
|
+
before :context do
|
4
4
|
start_agent
|
5
5
|
end
|
6
6
|
before do
|
@@ -10,7 +10,11 @@ describe Appsignal::Hooks::ActiveSupportNotificationsHook do
|
|
10
10
|
let(:notifier) { ActiveSupport::Notifications::Fanout.new }
|
11
11
|
let(:instrumenter) { ActiveSupport::Notifications::Instrumenter.new(notifier) }
|
12
12
|
|
13
|
-
|
13
|
+
describe "#dependencies_present?" do
|
14
|
+
subject { described_class.new.dependencies_present? }
|
15
|
+
|
16
|
+
it { is_expected.to be_truthy }
|
17
|
+
end
|
14
18
|
|
15
19
|
it "should instrument an AS notifications instrument call with a block" do
|
16
20
|
expect(Appsignal::Transaction.current).to receive(:start_event)
|
@@ -37,6 +41,10 @@ describe Appsignal::Hooks::ActiveSupportNotificationsHook do
|
|
37
41
|
expect(return_value).to eq "value"
|
38
42
|
end
|
39
43
|
else
|
40
|
-
|
44
|
+
describe "#dependencies_present?" do
|
45
|
+
subject { described_class.new.dependencies_present? }
|
46
|
+
|
47
|
+
it { is_expected.to be_falsy }
|
48
|
+
end
|
41
49
|
end
|
42
50
|
end
|
@@ -1,17 +1,21 @@
|
|
1
1
|
describe Appsignal::Hooks::CelluloidHook do
|
2
2
|
context "with celluloid" do
|
3
|
-
before :
|
3
|
+
before :context do
|
4
4
|
module Celluloid
|
5
5
|
def self.shutdown
|
6
6
|
end
|
7
7
|
end
|
8
8
|
Appsignal::Hooks::CelluloidHook.new.install
|
9
9
|
end
|
10
|
-
after :
|
10
|
+
after :context do
|
11
11
|
Object.send(:remove_const, :Celluloid)
|
12
12
|
end
|
13
13
|
|
14
|
-
|
14
|
+
describe "#dependencies_present?" do
|
15
|
+
subject { described_class.new.dependencies_present? }
|
16
|
+
|
17
|
+
it { is_expected.to be_truthy }
|
18
|
+
end
|
15
19
|
|
16
20
|
specify { expect(Appsignal).to receive(:stop) }
|
17
21
|
specify { expect(Celluloid).to receive(:shutdown_without_appsignal) }
|
@@ -22,6 +26,10 @@ describe Appsignal::Hooks::CelluloidHook do
|
|
22
26
|
end
|
23
27
|
|
24
28
|
context "without celluloid" do
|
25
|
-
|
29
|
+
describe "#dependencies_present?" do
|
30
|
+
subject { described_class.new.dependencies_present? }
|
31
|
+
|
32
|
+
it { is_expected.to be_falsy }
|
33
|
+
end
|
26
34
|
end
|
27
35
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
describe Appsignal::Hooks::DataMapperHook do
|
2
2
|
context "with datamapper" do
|
3
|
-
before :
|
3
|
+
before :context do
|
4
4
|
module DataMapper
|
5
5
|
end
|
6
6
|
module DataObjects
|
@@ -10,12 +10,16 @@ describe Appsignal::Hooks::DataMapperHook do
|
|
10
10
|
Appsignal::Hooks::DataMapperHook.new.install
|
11
11
|
end
|
12
12
|
|
13
|
-
after :
|
13
|
+
after :context do
|
14
14
|
Object.send(:remove_const, :DataMapper)
|
15
15
|
Object.send(:remove_const, :DataObjects)
|
16
16
|
end
|
17
17
|
|
18
|
-
|
18
|
+
describe "#dependencies_present?" do
|
19
|
+
subject { described_class.new.dependencies_present? }
|
20
|
+
|
21
|
+
it { is_expected.to be_truthy }
|
22
|
+
end
|
19
23
|
|
20
24
|
it "should install the listener" do
|
21
25
|
expect(::DataObjects::Connection).to receive(:include)
|
@@ -26,6 +30,10 @@ describe Appsignal::Hooks::DataMapperHook do
|
|
26
30
|
end
|
27
31
|
|
28
32
|
context "without datamapper" do
|
29
|
-
|
33
|
+
describe "#dependencies_present?" do
|
34
|
+
subject { described_class.new.dependencies_present? }
|
35
|
+
|
36
|
+
it { is_expected.to be_falsy }
|
37
|
+
end
|
30
38
|
end
|
31
39
|
end
|