blinkist-airbrake-scrubber 2.0.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 26b04669e1e76ff52a36ac1314e6271d0f17c573
4
- data.tar.gz: 26e55291dfc186dcd8cef6e7258280af6cfac602
3
+ metadata.gz: b85ab4bf932163ef87c58a0213d5a66eedcba189
4
+ data.tar.gz: 672688d23f9af0da1b52ae0eba8db74612810677
5
5
  SHA512:
6
- metadata.gz: 6a175c197481afe6e2c2d2d859aa5dfc00a398a844026800f457573ca535273bede664e5d409cd60bd31f0cc249dd17f995186bc15fbc44529bd1f3f21755873
7
- data.tar.gz: d3932da443ff99c942f11605ccf4fec33098a14b85c2bb0ce6ca9e53c1d17cf07f97998e43f9c53657f6c6a70dd1b9a5425f8307d98343ddf9c6b8a2b77f3697
6
+ metadata.gz: 88453a2053ff065c9e41a841ee984436c625dac0934dba868442faf547d00128657f3c45abeda6773b234e3a0cd903a4c897f750a73d40c9eb96ea4ea6350047
7
+ data.tar.gz: c5db35d6b008865fb28bf78dab40eff29aa379a53852fb1cd26cef618b72581c774deb8590ed2176c38e334dac4df172d696a4a97d43817763bd619af95f6aac
@@ -6,10 +6,15 @@ module Blinkist
6
6
 
7
7
  def self.scrub!
8
8
  ::Airbrake.add_filter do |notice|
9
- notice[:errors].each { |error| error[:message].gsub!(REGEXP, FILTERED) }
9
+ # Cannot do gsub! coz of frozen literals
10
+ notice[:errors].each { |error| error[:message] = scrub(error[:message]) }
10
11
  end
11
12
  end # def self.scrub!
12
13
 
14
+ def self.scrub(message)
15
+ message.gsub(REGEXP, FILTERED)
16
+ end
17
+
13
18
  end
14
19
  end
15
20
  end
@@ -1,7 +1,7 @@
1
1
  module Blinkist
2
2
  module Airbrake
3
3
  module Scrubber
4
- VERSION = "2.0.0"
4
+ VERSION = "2.0.1"
5
5
  end
6
6
  end
7
7
  end
@@ -23,7 +23,7 @@ describe Blinkist::Airbrake::Scrubber::MessageEmail do
23
23
 
24
24
  # It's ridiculously hard to peek into Airbrake::Notice
25
25
  # Instead verify the functionality here
26
- describe "scrubber functionality" do
26
+ describe ".scrub" do
27
27
  let(:filtered) { Blinkist::Airbrake::Scrubber::FILTERED }
28
28
  let(:regexp) { described_class::REGEXP }
29
29
 
@@ -36,14 +36,14 @@ describe Blinkist::Airbrake::Scrubber::MessageEmail do
36
36
  it "filters out valid emails" do
37
37
  puts "Verifying: #{ valid_emails.join ', ' }"
38
38
  valid_emails.each do |email|
39
- expect(email.gsub(regexp, filtered)).to eq(filtered)
39
+ expect(described_class.scrub(email)).to eq(filtered)
40
40
  end
41
41
  end
42
42
 
43
43
  it "filters out invalid emails" do
44
44
  puts "Verifying: #{ invalid_emails.join ', ' }"
45
45
  invalid_emails.each do |email|
46
- expect(email.gsub(regexp, filtered)).to eq(filtered)
46
+ expect(described_class.scrub(email)).to eq(filtered)
47
47
  end
48
48
  end
49
49
  end
@@ -55,7 +55,7 @@ describe Blinkist::Airbrake::Scrubber::MessageEmail do
55
55
  puts "Verifying: #{ valid_emails.join ', ' }"
56
56
  valid_emails.each do |email|
57
57
  content = text.gsub('EMAIL', email)
58
- expect(content.gsub(regexp, filtered)).to eq(text.gsub('EMAIL', filtered))
58
+ expect(described_class.scrub(content)).to eq(text.gsub('EMAIL', filtered))
59
59
  end
60
60
  end
61
61
 
@@ -63,10 +63,19 @@ describe Blinkist::Airbrake::Scrubber::MessageEmail do
63
63
  puts "Verifying: #{ invalid_emails.join ', ' }"
64
64
  invalid_emails.each do |email|
65
65
  content = text.gsub('EMAIL', email)
66
- expect(content.gsub(regexp, filtered)).to eq(text.gsub('EMAIL', filtered))
66
+ expect(described_class.scrub(content)).to eq(text.gsub('EMAIL', filtered))
67
67
  end
68
68
  end
69
69
  end
70
+
71
+ context "Anything that is a frozen string" do
72
+ subject { described_class.scrub text }
73
+ let(:text) { "Error bla bla bla test@example.org bla bla bla".freeze }
74
+
75
+ it "filters out email" do
76
+ expect(subject).to eq(text.gsub('test@example.org', filtered))
77
+ end
78
+ end
70
79
  end
71
80
 
72
81
  end
@@ -10,9 +10,9 @@ describe Blinkist::Airbrake::Scrubber::VERSION do
10
10
  expect(version.instance_of?(String)).to be true
11
11
  end
12
12
 
13
- it 'equals 2.0.0 for auto-check purposes' do
13
+ it 'equals 2.0.1 for auto-check purposes' do
14
14
  version = Blinkist::Airbrake::Scrubber::VERSION
15
- expect(version).to eq '2.0.0'
15
+ expect(version).to eq '2.0.1'
16
16
  end
17
17
 
18
18
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blinkist-airbrake-scrubber
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paweł Komarnicki
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-05-23 00:00:00.000000000 Z
12
+ date: 2018-05-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: airbrake