slack-notifier 1.2.1 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b724540f4fb01a3f48950fee034eda3af6b3fb4a
4
- data.tar.gz: a56880a665af231f4ce81d5bead28f7db048abdf
3
+ metadata.gz: 79b056b73685dbdd4d4172685ec26bbcc2d56b44
4
+ data.tar.gz: ff1568f0280763fe1079512389b7cba3e34a48aa
5
5
  SHA512:
6
- metadata.gz: d843ebf95f96255e4c4fc470876ab1937af610b0a94805ebd0acd02673e508ed8c63772dd9ebff22773daa5c693f42daa5d55f20a34d3b436d151d7a67ad0252
7
- data.tar.gz: 78f341412567858fca8ff81bb1f5fc9e222d4cc6b734de43c6a1781fcc552e9a3c7147f9733e76b71768ee25a8f2ef5271b774c83dcc449866bc410564c5a1b2
6
+ metadata.gz: fc041be0c332e467e1cee9e59ea1e2f688c780c1886c2cbf25205e96f8c21714a23352d5649645fa86dfe32ce68958394f564bdb82d92b14655d8ba29caea44d
7
+ data.tar.gz: 88c2002407abbb61df56cfbd4d3554d9f2676e86aebab6c7cce890d1b065b5948986d6c1fd6e0ad3bc8dc3eebef8297bf54cd498f1963ae848284a3bd2276942
@@ -46,5 +46,11 @@ module Slack
46
46
  default_payload[:username] = username
47
47
  end
48
48
 
49
+ HTML_ESCAPE_REGEXP = /[&><]/
50
+ HTML_ESCAPE = { '&' => '&amp;', '>' => '&gt;', '<' => '&lt;' }
51
+
52
+ def escape(text)
53
+ text.gsub(HTML_ESCAPE_REGEXP, HTML_ESCAPE)
54
+ end
49
55
  end
50
56
  end
@@ -1,5 +1,5 @@
1
1
  module Slack
2
2
  class Notifier
3
- VERSION = "1.2.1"
3
+ VERSION = "1.3.0"
4
4
  end
5
5
  end
@@ -109,4 +109,12 @@ describe Slack::Notifier do
109
109
  expect( subject.username ).to eq "foo"
110
110
  end
111
111
  end
112
+
113
+ describe "#escape" do
114
+ it "escapes sequences of < > &, but not quotes" do
115
+ message = %q(I've heard "Do > with <" & that sounds ridiculous.)
116
+ expected = %q(I've heard "Do &gt; with &lt;" &amp; that sounds ridiculous.)
117
+ expect( subject.escape(message) ).to eq expected
118
+ end
119
+ end
112
120
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slack-notifier
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steven Sloan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-18 00:00:00.000000000 Z
11
+ date: 2015-09-04 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: ' A slim ruby wrapper for posting to slack webhooks '
14
14
  email: