appsignal 2.10.4 → 2.10.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -93,6 +93,16 @@ if DependencyHelper.grape_present?
93
93
  expect(transaction).to receive(:set_error).with(kind_of(ExampleException))
94
94
  end
95
95
 
96
+ context "with env['grape.skip_appsignal_error'] = true" do
97
+ before do
98
+ env["grape.skip_appsignal_error"] = true
99
+ end
100
+
101
+ it "does not add the error" do
102
+ expect(transaction).to_not receive(:set_error)
103
+ end
104
+ end
105
+
96
106
  after do
97
107
  expect { middleware.call(env) }.to raise_error ExampleException
98
108
  end
@@ -285,19 +285,19 @@ describe Appsignal::Minutely do
285
285
  end
286
286
 
287
287
  describe "#<<" do
288
- let(:out_stream) { std_stream }
289
- let(:output) { out_stream.read }
288
+ let(:err_stream) { std_stream }
289
+ let(:stderr) { err_stream.read }
290
290
  let(:log_stream) { std_stream }
291
291
  let(:log) { log_contents(log_stream) }
292
292
  before { Appsignal.logger = test_logger(log_stream) }
293
293
 
294
294
  it "adds the probe, but prints a deprecation warning" do
295
295
  probe = lambda {}
296
- capture_stdout(out_stream) { collection << probe }
296
+ capture_std_streams(std_stream, err_stream) { collection << probe }
297
297
  deprecation_message = "Deprecated " \
298
298
  "`Appsignal::Minute.probes <<` call. Please use " \
299
299
  "`Appsignal::Minutely.probes.register` instead."
300
- expect(output).to include "appsignal WARNING: #{deprecation_message}"
300
+ expect(stderr).to include "appsignal WARNING: #{deprecation_message}"
301
301
  expect(log).to contains_log :warn, deprecation_message
302
302
  expect(collection[probe.object_id]).to eql(probe)
303
303
  end
@@ -11,18 +11,22 @@ describe Appsignal::Rack::JSExceptionCatcher do
11
11
  before { Appsignal.config = config }
12
12
 
13
13
  describe "#initialize" do
14
+ let(:out_stream) { std_stream }
15
+ let(:err_stream) { std_stream }
16
+ let(:output) { out_stream.read }
17
+ let(:stderr) { err_stream.read }
18
+
14
19
  it "logs to the logger" do
15
- stdout = std_stream
16
- stderr = std_stream
17
20
  log = capture_logs do
18
- capture_std_streams(stdout, stderr) do
21
+ capture_std_streams(out_stream, err_stream) do
19
22
  Appsignal::Rack::JSExceptionCatcher.new(app, options)
20
23
  end
21
24
  end
22
25
  expect(log).to contains_log(:warn, deprecation_message)
23
26
  expect(log).to contains_log(:debug, "Initializing Appsignal::Rack::JSExceptionCatcher")
24
- expect(stdout.read).to include "appsignal WARNING: #{deprecation_message}"
25
- expect(stderr.read).to_not include("appsignal:")
27
+ expect(stderr).to include "appsignal WARNING: #{deprecation_message}"
28
+ expect(stderr).to_not include("appsignal:")
29
+ expect(output).to be_empty
26
30
  end
27
31
  end
28
32
 
@@ -574,7 +574,7 @@ describe Appsignal::Transaction do
574
574
  end
575
575
 
576
576
  context "when the data cannot be converted to JSON" do
577
- it "does not update the sample data on the transaction" do
577
+ it "does not update the sample data on the transaction", :not_ruby19 do
578
578
  klass = Class.new do
579
579
  def to_s
580
580
  raise "foo" # Cause a deliberate error
@@ -586,6 +586,19 @@ describe Appsignal::Transaction do
586
586
  expect(log_contents(log)).to contains_log :error,
587
587
  "Error generating data (RuntimeError: foo) for"
588
588
  end
589
+
590
+ it "does not update the sample data on the transaction", :only_ruby19 do
591
+ klass = Class.new do
592
+ def to_s
593
+ raise "foo" # Cause a deliberate error
594
+ end
595
+ end
596
+ transaction.set_sample_data("params", klass.new => 1)
597
+
598
+ expect(transaction.to_h["sample_data"]).to eq({})
599
+ expect(log_contents(log)).to contains_log :error,
600
+ "Error generating data (RuntimeError: foo). Can't inspect data."
601
+ end
589
602
  end
590
603
  end
591
604
 
@@ -143,7 +143,9 @@ 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 { expect(subject).to be_instance_of(Net::HTTP) }
146
+ it "is of Net::HTTP class", :not_ruby19 do
147
+ expect(subject).to be_instance_of(Net::HTTP)
148
+ end
147
149
  it { expect(subject.proxy?).to be_truthy }
148
150
  it { expect(subject.proxy_address).to eq "localhost" }
149
151
  it { expect(subject.proxy_port).to eq 8080 }
@@ -949,7 +949,7 @@ describe Appsignal do
949
949
 
950
950
  it "outputs deprecated warning" do
951
951
  subject
952
- expect(stderr).to include("Appsignal.is_ignored_error? is deprecated with no replacement.")
952
+ expect(stderr).to include("Appsignal.is_ignored_error? is deprecated with no replacement")
953
953
  end
954
954
 
955
955
  context "when error is not in the ignored list" do
@@ -981,7 +981,7 @@ describe Appsignal do
981
981
 
982
982
  it "outputs deprecated warning" do
983
983
  subject
984
- expect(stderr).to include("Appsignal.is_ignored_action? is deprecated with no replacement.")
984
+ expect(stderr).to include("Appsignal.is_ignored_action? is deprecated with no replacement")
985
985
  end
986
986
 
987
987
  context "when action is not in the ingore list" do
@@ -9,7 +9,6 @@ Bundler.require :default
9
9
  require "cgi"
10
10
  require "rack"
11
11
  require "rspec"
12
- require "pry"
13
12
  require "timecop"
14
13
  require "webmock/rspec"
15
14
 
@@ -30,6 +29,7 @@ if DependencyHelper.rails_present?
30
29
  require f
31
30
  end
32
31
  end
32
+ require "pry" if DependencyHelper.dependency_present?("pry")
33
33
  require "appsignal"
34
34
  # Include patches of AppSignal modules and classes to make test helpers
35
35
  # available.
@@ -81,6 +81,20 @@ RSpec.configure do |config|
81
81
  FileUtils.mkdir_p(spec_system_tmp_dir)
82
82
  end
83
83
 
84
+ config.before :each, :only_ruby19 => true do
85
+ is_ruby19 = Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.0.0")
86
+ next if is_ruby19
87
+
88
+ skip "Skipping spec. Only for Ruby 1.9"
89
+ end
90
+
91
+ config.before :each, :not_ruby19 => true do
92
+ is_ruby19 = Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.0.0")
93
+ next unless is_ruby19
94
+
95
+ skip "Skipping spec for Ruby 1.9"
96
+ end
97
+
84
98
  config.before do
85
99
  stop_minutely_probes
86
100
  ENV["RAILS_ENV"] ||= "test"
@@ -2,7 +2,10 @@
2
2
 
3
3
  set -eu
4
4
 
5
- gem_args="--no-document --no-verbose"
5
+ gem_args="--no-verbose"
6
+ if [[ $(ruby --version) != "ruby 1.9.3"* ]]; then
7
+ gem_args+=" --no-document"
8
+ fi
6
9
 
7
10
  case "${_RUBYGEMS_VERSION-"latest"}" in
8
11
  "latest")
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appsignal
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.10.4
4
+ version: 2.10.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Beekman
8
8
  - Thijs Cadier
9
9
  - Tom de Bruijn
10
- autorequire:
10
+ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2020-02-28 00:00:00.000000000 Z
13
+ date: 2020-06-16 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rack
@@ -55,7 +55,7 @@ dependencies:
55
55
  - !ruby/object:Gem::Version
56
56
  version: '3.8'
57
57
  - !ruby/object:Gem::Dependency
58
- name: pry
58
+ name: timecop
59
59
  requirement: !ruby/object:Gem::Requirement
60
60
  requirements:
61
61
  - - ">="
@@ -69,7 +69,7 @@ dependencies:
69
69
  - !ruby/object:Gem::Version
70
70
  version: '0'
71
71
  - !ruby/object:Gem::Dependency
72
- name: timecop
72
+ name: webmock
73
73
  requirement: !ruby/object:Gem::Requirement
74
74
  requirements:
75
75
  - - ">="
@@ -83,47 +83,47 @@ dependencies:
83
83
  - !ruby/object:Gem::Version
84
84
  version: '0'
85
85
  - !ruby/object:Gem::Dependency
86
- name: webmock
86
+ name: yard
87
87
  requirement: !ruby/object:Gem::Requirement
88
88
  requirements:
89
89
  - - ">="
90
90
  - !ruby/object:Gem::Version
91
- version: '0'
91
+ version: 0.9.20
92
92
  type: :development
93
93
  prerelease: false
94
94
  version_requirements: !ruby/object:Gem::Requirement
95
95
  requirements:
96
96
  - - ">="
97
97
  - !ruby/object:Gem::Version
98
- version: '0'
98
+ version: 0.9.20
99
99
  - !ruby/object:Gem::Dependency
100
- name: rubocop
100
+ name: pry
101
101
  requirement: !ruby/object:Gem::Requirement
102
102
  requirements:
103
- - - '='
103
+ - - ">="
104
104
  - !ruby/object:Gem::Version
105
- version: 0.50.0
105
+ version: '0'
106
106
  type: :development
107
107
  prerelease: false
108
108
  version_requirements: !ruby/object:Gem::Requirement
109
109
  requirements:
110
- - - '='
110
+ - - ">="
111
111
  - !ruby/object:Gem::Version
112
- version: 0.50.0
112
+ version: '0'
113
113
  - !ruby/object:Gem::Dependency
114
- name: yard
114
+ name: rubocop
115
115
  requirement: !ruby/object:Gem::Requirement
116
116
  requirements:
117
- - - ">="
117
+ - - '='
118
118
  - !ruby/object:Gem::Version
119
- version: 0.9.20
119
+ version: 0.50.0
120
120
  type: :development
121
121
  prerelease: false
122
122
  version_requirements: !ruby/object:Gem::Requirement
123
123
  requirements:
124
- - - ">="
124
+ - - '='
125
125
  - !ruby/object:Gem::Version
126
- version: 0.9.20
126
+ version: 0.50.0
127
127
  description: The official appsignal.com gem
128
128
  email:
129
129
  - support@appsignal.com
@@ -379,7 +379,7 @@ metadata:
379
379
  documentation_uri: https://docs.appsignal.com/ruby/
380
380
  homepage_uri: https://docs.appsignal.com/ruby/
381
381
  source_code_uri: https://github.com/appsignal/appsignal-ruby
382
- post_install_message:
382
+ post_install_message:
383
383
  rdoc_options: []
384
384
  require_paths:
385
385
  - lib
@@ -395,8 +395,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
395
395
  - !ruby/object:Gem::Version
396
396
  version: '0'
397
397
  requirements: []
398
- rubygems_version: 3.1.2
399
- signing_key:
398
+ rubygems_version: 3.1.4
399
+ signing_key:
400
400
  specification_version: 4
401
401
  summary: Logs performance and exception data from your app to appsignal.com
402
402
  test_files: