appsignal 1.3.6 → 1.4.0.alpha.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -1
  3. data/.rspec +1 -3
  4. data/CHANGELOG.md +2 -28
  5. data/Rakefile +2 -2
  6. data/benchmark.rake +4 -0
  7. data/circle.yml +12 -0
  8. data/ext/agent.yml +11 -11
  9. data/ext/appsignal_extension.c +3 -3
  10. data/ext/extconf.rb +4 -4
  11. data/lib/appsignal.rb +10 -27
  12. data/lib/appsignal/cli/diagnose.rb +3 -4
  13. data/lib/appsignal/cli/install.rb +15 -16
  14. data/lib/appsignal/config.rb +7 -18
  15. data/lib/appsignal/event_formatter.rb +1 -1
  16. data/lib/appsignal/integrations/capistrano/appsignal.cap +1 -1
  17. data/lib/appsignal/integrations/capistrano/capistrano_2_tasks.rb +2 -2
  18. data/lib/appsignal/integrations/object.rb +4 -4
  19. data/lib/appsignal/integrations/sinatra.rb +1 -1
  20. data/lib/appsignal/integrations/webmachine.rb +1 -1
  21. data/lib/appsignal/js_exception_transaction.rb +0 -1
  22. data/lib/appsignal/marker.rb +2 -3
  23. data/lib/appsignal/rack/sinatra_instrumentation.rb +5 -12
  24. data/lib/appsignal/rack/streaming_listener.rb +2 -4
  25. data/lib/appsignal/transaction.rb +3 -3
  26. data/lib/appsignal/transmitter.rb +7 -11
  27. data/lib/appsignal/utils.rb +0 -6
  28. data/lib/appsignal/version.rb +1 -1
  29. data/spec/lib/appsignal/auth_check_spec.rb +2 -0
  30. data/spec/lib/appsignal/capistrano2_spec.rb +78 -98
  31. data/spec/lib/appsignal/capistrano3_spec.rb +77 -56
  32. data/spec/lib/appsignal/cli/diagnose_spec.rb +13 -12
  33. data/spec/lib/appsignal/cli/install_spec.rb +15 -38
  34. data/spec/lib/appsignal/cli/notify_of_deploy_spec.rb +5 -2
  35. data/spec/lib/appsignal/cli_spec.rb +5 -2
  36. data/spec/lib/appsignal/config_spec.rb +17 -131
  37. data/spec/lib/appsignal/event_formatter/action_view/render_formatter_spec.rb +2 -0
  38. data/spec/lib/appsignal/event_formatter/active_record/instantiation_formatter_spec.rb +2 -0
  39. data/spec/lib/appsignal/event_formatter/active_record/sql_formatter_spec.rb +2 -0
  40. data/spec/lib/appsignal/event_formatter/elastic_search/search_formatter_spec.rb +2 -0
  41. data/spec/lib/appsignal/event_formatter/faraday/request_formatter_spec.rb +2 -0
  42. data/spec/lib/appsignal/event_formatter/mongo_ruby_driver/query_formatter_spec.rb +2 -0
  43. data/spec/lib/appsignal/event_formatter/moped/query_formatter_spec.rb +2 -0
  44. data/spec/lib/appsignal/event_formatter_spec.rb +2 -0
  45. data/spec/lib/appsignal/extension_spec.rb +1 -0
  46. data/spec/lib/appsignal/hooks/celluloid_spec.rb +2 -0
  47. data/spec/lib/appsignal/hooks/data_mapper_spec.rb +2 -0
  48. data/spec/lib/appsignal/hooks/delayed_job_spec.rb +2 -0
  49. data/spec/lib/appsignal/hooks/mongo_ruby_driver_spec.rb +2 -0
  50. data/spec/lib/appsignal/hooks/net_http_spec.rb +2 -0
  51. data/spec/lib/appsignal/hooks/passenger_spec.rb +2 -0
  52. data/spec/lib/appsignal/hooks/puma_spec.rb +2 -0
  53. data/spec/lib/appsignal/hooks/rake_spec.rb +1 -0
  54. data/spec/lib/appsignal/hooks/redis_spec.rb +2 -0
  55. data/spec/lib/appsignal/hooks/sequel_spec.rb +2 -0
  56. data/spec/lib/appsignal/hooks/shoryuken_spec.rb +4 -1
  57. data/spec/lib/appsignal/hooks/sidekiq_spec.rb +3 -2
  58. data/spec/lib/appsignal/hooks/unicorn_spec.rb +2 -0
  59. data/spec/lib/appsignal/hooks/webmachine_spec.rb +8 -2
  60. data/spec/lib/appsignal/hooks_spec.rb +2 -0
  61. data/spec/lib/appsignal/integrations/data_mapper_spec.rb +1 -0
  62. data/spec/lib/appsignal/integrations/grape_spec.rb +2 -0
  63. data/spec/lib/appsignal/integrations/mongo_ruby_driver_spec.rb +1 -0
  64. data/spec/lib/appsignal/integrations/object_spec.rb +1 -30
  65. data/spec/lib/appsignal/integrations/padrino_spec.rb +2 -0
  66. data/spec/lib/appsignal/integrations/railtie_spec.rb +2 -0
  67. data/spec/lib/appsignal/integrations/resque_active_job_spec.rb +2 -0
  68. data/spec/lib/appsignal/integrations/resque_spec.rb +3 -1
  69. data/spec/lib/appsignal/integrations/sinatra_spec.rb +7 -32
  70. data/spec/lib/appsignal/integrations/webmachine_spec.rb +11 -4
  71. data/spec/lib/appsignal/js_exception_transaction_spec.rb +2 -0
  72. data/spec/lib/appsignal/marker_spec.rb +48 -35
  73. data/spec/lib/appsignal/minutely_spec.rb +2 -0
  74. data/spec/lib/appsignal/rack/generic_instrumentation_spec.rb +2 -0
  75. data/spec/lib/appsignal/rack/js_exception_catcher_spec.rb +2 -0
  76. data/spec/lib/appsignal/rack/rails_instrumentation_spec.rb +2 -0
  77. data/spec/lib/appsignal/rack/sinatra_instrumentation_spec.rb +6 -46
  78. data/spec/lib/appsignal/rack/streaming_listener_spec.rb +4 -3
  79. data/spec/lib/appsignal/subscriber_spec.rb +2 -0
  80. data/spec/lib/appsignal/transaction_spec.rb +3 -2
  81. data/spec/lib/appsignal/transmitter_spec.rb +20 -53
  82. data/spec/lib/appsignal/update_active_support_spec.rb +2 -0
  83. data/spec/lib/appsignal/utils/params_sanitizer_spec.rb +2 -0
  84. data/spec/lib/appsignal/utils/query_params_sanitizer_spec.rb +2 -0
  85. data/spec/lib/appsignal/utils_spec.rb +2 -0
  86. data/spec/lib/appsignal_spec.rb +37 -91
  87. data/spec/spec_helper.rb +28 -22
  88. metadata +5 -14
  89. data/spec/lib/appsignal/utils/gzip_spec.rb +0 -10
  90. data/spec/support/helpers/api_request_helper.rb +0 -19
  91. data/spec/support/helpers/directory_helper.rb +0 -25
  92. data/spec/support/helpers/std_streams_helper.rb +0 -35
  93. data/spec/support/helpers/very_specific_error.rb +0 -8
@@ -1,3 +1,5 @@
1
+ require 'spec_helper'
2
+
1
3
  describe Appsignal::Minutely do
2
4
  before do
3
5
  Appsignal::Minutely.probes.clear
@@ -1,3 +1,5 @@
1
+ require 'spec_helper'
2
+
1
3
  describe Appsignal::Rack::GenericInstrumentation do
2
4
  before :all do
3
5
  start_agent
@@ -1,3 +1,5 @@
1
+ require 'spec_helper'
2
+
1
3
  describe Appsignal::Rack::JSExceptionCatcher do
2
4
  let(:app) { double(:call => true) }
3
5
  let(:options) { double }
@@ -1,3 +1,5 @@
1
+ require 'spec_helper'
2
+
1
3
  class MockController
2
4
  end
3
5
 
@@ -1,3 +1,5 @@
1
+ require 'spec_helper'
2
+
1
3
  begin
2
4
  require 'sinatra'
3
5
  require 'appsignal/integrations/sinatra'
@@ -45,40 +47,6 @@ if defined?(::Sinatra)
45
47
  let(:options) { {} }
46
48
  let(:middleware) { Appsignal::Rack::SinatraBaseInstrumentation.new(app, options) }
47
49
 
48
- describe "#initialize" do
49
- context "with no settings method in the Sinatra app" do
50
- let(:app) { double(:call => true) }
51
-
52
- it "should not raise errors" do
53
- expect( middleware.raise_errors_on ).to be(false)
54
- end
55
- end
56
-
57
- context "with no raise_errors setting in the Sinatra app" do
58
- let(:app) { double(:call => true, :settings => double) }
59
-
60
- it "should not raise errors" do
61
- expect( middleware.raise_errors_on ).to be(false)
62
- end
63
- end
64
-
65
- context "with raise_errors turned off in the Sinatra app" do
66
- let(:app) { double(:call => true, :settings => double(:raise_errors => false)) }
67
-
68
- it "should raise errors" do
69
- expect( middleware.raise_errors_on ).to be(false)
70
- end
71
- end
72
-
73
- context "with raise_errors turned on in the Sinatra app" do
74
- let(:app) { double(:call => true, :settings => double(:raise_errors => true)) }
75
-
76
- it "should raise errors" do
77
- expect( middleware.raise_errors_on ).to be(true)
78
- end
79
- end
80
- end
81
-
82
50
  describe "#call" do
83
51
  before do
84
52
  middleware.stub(:raw_payload => {})
@@ -165,11 +133,11 @@ if defined?(::Sinatra)
165
133
  Appsignal::Transaction.any_instance.should_receive(:set_action).with('GET /')
166
134
  end
167
135
 
168
- context "without 'sinatra.route' env" do
169
- let(:env) { {:path => '/', :method => 'GET'} }
136
+ context "with option to set path a mounted_at prefix" do
137
+ let(:options) {{ :mounted_at => "/api/v2" }}
170
138
 
171
- it "returns nil" do
172
- Appsignal::Transaction.any_instance.should_receive(:set_action).with(nil)
139
+ it "should call set_action with a prefix path" do
140
+ Appsignal::Transaction.any_instance.should_receive(:set_action).with("GET /api/v2/")
173
141
  end
174
142
  end
175
143
 
@@ -179,14 +147,6 @@ if defined?(::Sinatra)
179
147
  it "should call set_action with an application prefix path" do
180
148
  Appsignal::Transaction.any_instance.should_receive(:set_action).with("GET /api/")
181
149
  end
182
-
183
- context "without 'sinatra.route' env" do
184
- let(:env) { {:path => '/', :method => 'GET'} }
185
-
186
- it "returns nil" do
187
- Appsignal::Transaction.any_instance.should_receive(:set_action).with(nil)
188
- end
189
- end
190
150
  end
191
151
  end
192
152
 
@@ -1,3 +1,4 @@
1
+ require 'spec_helper'
1
2
  require 'appsignal/rack/streaming_listener'
2
3
 
3
4
  describe Appsignal::Rack::StreamingListener do
@@ -88,7 +89,7 @@ describe Appsignal::Rack::StreamingListener do
88
89
 
89
90
  context "with an exception in the instrumentation call" do
90
91
  it "should add the exception to the transaction" do
91
- allow( app ).to receive(:call).and_raise(VerySpecificError.new)
92
+ allow( app ).to receive(:call).and_raise(VerySpecificError.new('broken'))
92
93
 
93
94
  expect( transaction ).to receive(:set_error)
94
95
 
@@ -123,7 +124,7 @@ describe Appsignal::StreamWrapper do
123
124
  context "when each raises an error" do
124
125
  it "should add the exception to the transaction" do
125
126
  allow( stream ).to receive(:each)
126
- .and_raise(VerySpecificError.new)
127
+ .and_raise(VerySpecificError.new('broken'))
127
128
 
128
129
  expect( transaction ).to receive(:set_error)
129
130
 
@@ -143,7 +144,7 @@ describe Appsignal::StreamWrapper do
143
144
  context "when each raises an error" do
144
145
  it "should add the exception to the transaction and close it" do
145
146
  allow( stream ).to receive(:close)
146
- .and_raise(VerySpecificError.new)
147
+ .and_raise(VerySpecificError.new('broken'))
147
148
 
148
149
  expect( transaction ).to receive(:set_error)
149
150
  expect( Appsignal::Transaction ).to receive(:complete_current!)
@@ -1,3 +1,5 @@
1
+ require 'spec_helper'
2
+
1
3
  describe Appsignal::Subscriber do
2
4
  before :all do
3
5
  start_agent
@@ -1,3 +1,5 @@
1
+ require 'spec_helper'
2
+
1
3
  class Smash < Hash
2
4
  def []=(key, val)
3
5
  raise 'the roof'
@@ -120,11 +122,10 @@ describe Appsignal::Transaction do
120
122
 
121
123
  context "if a transaction is discarded" do
122
124
  it "should not complete the transaction" do
123
- expect(Appsignal::Transaction.current.ext).to_not receive(:complete)
125
+ Appsignal::Transaction.current.should_not_receive(:complete)
124
126
 
125
127
  Appsignal::Transaction.current.discard!
126
128
  expect(Appsignal::Transaction.current.discarded?).to be_true
127
-
128
129
  Appsignal::Transaction.complete_current!
129
130
 
130
131
  Thread.current[:appsignal_transaction].should be_nil
@@ -1,14 +1,13 @@
1
+ require 'spec_helper'
2
+
1
3
  describe Appsignal::Transmitter do
2
4
  let(:config) { project_fixture_config }
3
5
  let(:action) { 'action' }
4
- let(:log) { StringIO.new }
5
6
  let(:instance) { Appsignal::Transmitter.new(action, config) }
6
- before do
7
- config.config_hash[:hostname] = 'app1.local'
8
- config.logger = Logger.new(log)
9
- end
10
7
 
11
8
  describe "#uri" do
9
+ before { ENV['APPSIGNAL_HOSTNAME'] = 'app1.local' }
10
+
12
11
  subject { instance.uri.to_s }
13
12
 
14
13
  it { should include 'https://push.appsignal.com/1/action?' }
@@ -23,11 +22,9 @@ describe Appsignal::Transmitter do
23
22
  before do
24
23
  stub_request(
25
24
  :post,
26
- "https://push.appsignal.com/1/action?api_key=abc"\
27
- "&environment=production&gem_version=#{Appsignal::VERSION}"\
28
- "&hostname=#{config.config_hash[:hostname]}&name=TestApp"
25
+ "https://push.appsignal.com/1/action?api_key=abc&environment=production&gem_version=#{Appsignal::VERSION}&hostname=#{Socket.gethostname}&name=TestApp"
29
26
  ).with(
30
- :body => Appsignal::Utils::Gzip.compress("{\"the\":\"payload\"}"),
27
+ :body => Zlib::Deflate.deflate("{\"the\":\"payload\"}", Zlib::BEST_SPEED),
31
28
  :headers => {
32
29
  'Content-Encoding' => 'gzip',
33
30
  'Content-Type' => 'application/json; charset=UTF-8',
@@ -36,57 +33,20 @@ describe Appsignal::Transmitter do
36
33
  :status => 200
37
34
  )
38
35
  end
36
+
39
37
  subject { instance.transmit(:the => :payload) }
40
38
 
41
39
  it { should eq '200' }
42
-
43
- context "with ca_file_path config option set" do
44
- context "when not existing file" do
45
- before do
46
- config.config_hash[:ca_file_path] = File.join(resources_dir, "cacert.pem")
47
- end
48
-
49
- it "ignores the config and logs a warning" do
50
- expect(subject).to eq '200'
51
- expect(log.string).to_not include "Ignoring non-existing or unreadable " \
52
- "`ca_file_path`: #{config[:ca_file_path]}"
53
- end
54
- end
55
-
56
- context "when not existing file" do
57
- before do
58
- config.config_hash[:ca_file_path] = File.join(tmp_dir, "ca_file_that_does_not_exist")
59
- end
60
-
61
- it "ignores the config and logs a warning" do
62
- expect(subject).to eq '200'
63
- expect(log.string).to include "Ignoring non-existing or unreadable " \
64
- "`ca_file_path`: #{config[:ca_file_path]}"
65
- end
66
- end
67
-
68
- context "when not readable file" do
69
- let(:file) { File.join(tmp_dir, "ca_file") }
70
- before do
71
- config.config_hash[:ca_file_path] = file
72
- File.open(file, "w") { |f| f.chmod 0000 }
73
- end
74
-
75
- it "ignores the config and logs a warning" do
76
- expect(subject).to eq '200'
77
- expect(log.string).to include "Ignoring non-existing or unreadable " \
78
- "`ca_file_path`: #{config[:ca_file_path]}"
79
- end
80
-
81
- after { File.delete file }
82
- end
83
- end
84
40
  end
85
41
 
86
42
  describe "#http_post" do
43
+ before do
44
+ Socket.stub(:gethostname => 'app1.local')
45
+ end
46
+
87
47
  subject { instance.send(:http_post, 'the' => 'payload') }
88
48
 
89
- its(:body) { should eq Appsignal::Utils::Gzip.compress("{\"the\":\"payload\"}") }
49
+ its(:body) { should eq Zlib::Deflate.deflate("{\"the\":\"payload\"}", Zlib::BEST_SPEED) }
90
50
  its(:path) { should eq instance.uri.request_uri }
91
51
 
92
52
  it "should have the correct headers" do
@@ -95,6 +55,13 @@ describe Appsignal::Transmitter do
95
55
  end
96
56
  end
97
57
 
58
+ describe ".CA_FILE_PATH" do
59
+ subject { Appsignal::Transmitter::CA_FILE_PATH }
60
+
61
+ it { should include('resources/cacert.pem') }
62
+ it("should exist") { File.exist?(subject).should be_true }
63
+ end
64
+
98
65
  describe "#http_client" do
99
66
  subject { instance.send(:http_client) }
100
67
 
@@ -113,7 +80,7 @@ describe Appsignal::Transmitter do
113
80
  its(:proxy?) { should be_false }
114
81
  its(:use_ssl?) { should be_true }
115
82
  its(:verify_mode) { should eq OpenSSL::SSL::VERIFY_PEER }
116
- its(:ca_file) { should eq config[:ca_file_path] }
83
+ its(:ca_file) { Appsignal::Transmitter::CA_FILE_PATH }
117
84
  end
118
85
 
119
86
  context "with a proxy" do
@@ -1,3 +1,5 @@
1
+ require 'spec_helper'
2
+
1
3
  describe 'Appsignal::UpdateActiveSupport', :if => (
2
4
  Gem.loaded_specs['rails'] &&
3
5
  Gem.loaded_specs['rails'].version < Gem::Version.create('4.0')
@@ -1,3 +1,5 @@
1
+ require 'spec_helper'
2
+
1
3
  describe Appsignal::Utils::ParamsSanitizer do
2
4
  let(:file) { uploaded_file }
3
5
  let(:params) do
@@ -1,3 +1,5 @@
1
+ require 'spec_helper'
2
+
1
3
  describe Appsignal::Utils::QueryParamsSanitizer do
2
4
  describe ".sanitize" do
3
5
  context "when only_top_level = true" do
@@ -1,5 +1,7 @@
1
1
  # encoding: UTF-8
2
2
 
3
+ require 'spec_helper'
4
+
3
5
  describe Appsignal::Utils do
4
6
  describe ".json_generate" do
5
7
  subject { Appsignal::Utils.json_generate(body) }
@@ -1,3 +1,4 @@
1
+ require 'spec_helper'
1
2
  require './spec/support/mocks/mock_extension'
2
3
 
3
4
  describe Appsignal do
@@ -360,7 +361,7 @@ describe Appsignal do
360
361
  end
361
362
 
362
363
  context "with an erroring call" do
363
- let(:error) { VerySpecificError.new }
364
+ let(:error) { VerySpecificError.new('the roof') }
364
365
 
365
366
  it "should add the error to the current transaction and complete" do
366
367
  Appsignal::Transaction.any_instance.should_receive(:set_error).with(error)
@@ -391,7 +392,7 @@ describe Appsignal do
391
392
  end
392
393
 
393
394
  context "with an erroring call" do
394
- let(:error) { VerySpecificError.new }
395
+ let(:error) { VerySpecificError.new('the roof') }
395
396
 
396
397
  it "should call monitor_transaction and stop and then raise the error" do
397
398
  Appsignal.should_receive(:monitor_transaction).with(
@@ -550,124 +551,69 @@ describe Appsignal do
550
551
 
551
552
  describe ".start_logger" do
552
553
  let(:out_stream) { StringIO.new }
553
- let(:log_path) { File.join(tmp_dir, 'log') }
554
+ let(:log_path) { File.join(project_fixture_path, 'log') }
554
555
  let(:log_file) { File.join(log_path, 'appsignal.log') }
555
556
 
556
557
  before do
557
- FileUtils.mkdir_p(log_path)
558
-
559
- Appsignal.logger.error('Log in memory')
558
+ FileUtils.rm_f(log_file)
559
+ @original_stdout = $stdout
560
+ $stdout = out_stream
561
+ Appsignal.logger.error('Log something')
560
562
  Appsignal.config = project_fixture_config(
561
563
  'production',
562
564
  :log_path => log_path
563
565
  )
564
566
  end
565
- around do |example|
566
- capture_stdout(out_stream) { example.run }
567
+ after do
568
+ $stdout = @original_stdout
567
569
  end
568
- after { FileUtils.rm_rf(log_path) }
569
570
 
570
571
  context "when the log path is writable" do
571
- context "when the log file is writable" do
572
- let(:log_file_contents) { File.open(log_file).read }
573
- before do
574
- Appsignal.start_logger
575
- Appsignal.logger.error('Log to file')
576
- end
577
-
578
- it "logs to file" do
579
- expect(File.exist?(log_file)).to be_true
580
- expect(log_file_contents).to include 'Log to file'
581
- end
582
-
583
- it "amends in memory log to log file" do
584
- expect(log_file_contents).to include 'Log in memory'
585
- end
586
- end
587
-
588
- context "when the log file is not writable" do
589
- before do
590
- FileUtils.touch log_file
591
- FileUtils.chmod 0444, log_file
592
-
593
- Appsignal.start_logger
594
- Appsignal.logger.error('Log to not writable log file')
595
- end
596
-
597
- it "logs to stdout" do
598
- expect(File.writable?(log_file)).to be_false
599
- expect(out_stream.string).to include 'Log to not writable log file'
600
- end
601
-
602
- it "outputs a warning" do
603
- output = out_stream.string
604
- expect(output).to include "appsignal: Unable to start logger with "\
605
- "log path '#{log_file}'."
606
- expect(output).to include "appsignal: Permission denied"
607
- end
608
- end
609
- end
610
-
611
- context "when the log path is not writable" do
612
- before do
613
- FileUtils.chmod 0444, log_path
614
-
572
+ it "should log to file" do
615
573
  Appsignal.start_logger
616
- Appsignal.logger.error('Log to not writable log path')
617
- end
618
-
619
- it "logs to stdout" do
620
- expect(File.writable?(log_path)).to be_false
621
- expect(out_stream.string).to include 'Log to not writable log path'
622
- end
623
-
624
- it "amends in memory log to stdout" do
625
- expect(out_stream.string).to include 'Log in memory'
574
+ Appsignal.logger.level.should eq Logger::INFO
575
+ Appsignal.logger.error('Log to file')
576
+ File.exist?(log_file).should be_true
577
+ File.open(log_file).read.should include 'Log to file'
578
+ File.open(log_file).read.should include 'Log something'
626
579
  end
627
580
  end
628
581
 
629
- context "when on Heroku" do
582
+ context "when we're on Heroku" do
630
583
  before do
631
584
  ENV['DYNO'] = 'dyno1'
632
- Appsignal.start_logger
633
- Appsignal.logger.error('Log to stdout')
634
585
  end
635
586
  after { ENV.delete('DYNO') }
636
587
 
637
588
  it "should log to stdout" do
589
+ Appsignal.start_logger
590
+ Appsignal.logger.level.should eq Logger::INFO
591
+ Appsignal.logger.error('Log to stdout')
638
592
  out_stream.string.should include 'appsignal: Log to stdout'
593
+ out_stream.string.should include 'Log something'
639
594
  end
595
+ end
640
596
 
641
- it "amends in memory log to stdout" do
642
- expect(out_stream.string).to include 'Log in memory'
597
+ context "when there is no in memory log" do
598
+ it "should not crash" do
599
+ Appsignal.in_memory_log = nil
600
+ Appsignal.start_logger
643
601
  end
644
602
  end
645
603
 
646
- describe "#logger#level" do
647
- subject { Appsignal.logger.level }
648
-
649
- context "when there is no config" do
650
- before do
651
- Appsignal.config = nil
652
- Appsignal.start_logger
653
- end
654
-
655
- it "sets the log level to info" do
656
- expect(subject).to eq Logger::INFO
657
- end
604
+ context "when there is no config and debug is on" do
605
+ it "should set the log level to info" do
606
+ Appsignal.config = nil
607
+ Appsignal.start_logger
608
+ Appsignal.logger.level.should eq Logger::INFO
658
609
  end
610
+ end
659
611
 
660
- context "when there is a config" do
661
- context "when log level is configured to debug" do
662
- before do
663
- Appsignal.config.config_hash[:debug] = true
664
- Appsignal.start_logger
665
- end
666
-
667
- it "sets the log level to debug" do
668
- expect(subject).to eq Logger::DEBUG
669
- end
670
- end
612
+ context "when there is a config and debug is on" do
613
+ it "should set the log level to debug" do
614
+ Appsignal.config.config_hash[:debug] = true
615
+ Appsignal.start_logger
616
+ Appsignal.logger.level.should eq Logger::DEBUG
671
617
  end
672
618
  end
673
619
  end