pushpop-slack 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pushpop-slack.rb +12 -0
- data/lib/pushpop-slack/version.rb +1 -1
- data/spec/pushpop-slack_spec.rb +41 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5c96e1ef88b8aa2058cd8957d9ff48ba35fdba0d
|
4
|
+
data.tar.gz: d499452bc3311a9f718a63148b5e081f96c49f7c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40dbd400ae0471435bc29bfdeb92173474f0055e4a721fef75edfcaa345e34ccef474ebef40ca25c536d766ce26ac4876389fc7c0b9847a1133db9d418e69352
|
7
|
+
data.tar.gz: 0c961695f21125d385b678fd3df5797cbaca665663eb2ae9d6314d9b68964bb542f6a89f9fd3b869bfec50a99144e6b1855dec0d1e135e5b817b8bbccabc02ed
|
data/lib/pushpop-slack.rb
CHANGED
@@ -21,6 +21,7 @@ module Pushpop
|
|
21
21
|
|
22
22
|
def run(last_response=nil, step_responses=nil)
|
23
23
|
|
24
|
+
|
24
25
|
ret = configure(last_response, step_responses)
|
25
26
|
|
26
27
|
if _message
|
@@ -29,9 +30,20 @@ module Pushpop
|
|
29
30
|
Pushpop.logger.debug("No slack message sent - message was not set")
|
30
31
|
end
|
31
32
|
|
33
|
+
clear_settings
|
34
|
+
|
32
35
|
ret
|
33
36
|
end
|
34
37
|
|
38
|
+
def clear_settings
|
39
|
+
self._username = nil
|
40
|
+
self._message = nil
|
41
|
+
self._icon = nil
|
42
|
+
self._icon_type = nil
|
43
|
+
self._attachments = nil
|
44
|
+
self._unfurl = nil
|
45
|
+
end
|
46
|
+
|
35
47
|
def send_message
|
36
48
|
unless WEBHOOK_URL.nil? || WEBHOOK_URL.empty?
|
37
49
|
notifier = ::Slack::Notifier.new WEBHOOK_URL
|
data/spec/pushpop-slack_spec.rb
CHANGED
@@ -139,4 +139,45 @@ describe Pushpop::Slack do
|
|
139
139
|
|
140
140
|
expect(step.options['unfurl_links']).to eq(true)
|
141
141
|
end
|
142
|
+
|
143
|
+
it 'clears everything out at the beginning of the run' do
|
144
|
+
username = nil
|
145
|
+
message = nil
|
146
|
+
icon = nil
|
147
|
+
icon_type = nil
|
148
|
+
attachments = nil
|
149
|
+
unf = nil
|
150
|
+
|
151
|
+
step = Pushpop::Slack.new do
|
152
|
+
username = self._username
|
153
|
+
message = self._message
|
154
|
+
icon = self._icon
|
155
|
+
icon_type = self._icon_type
|
156
|
+
attachments = self._attachments
|
157
|
+
unf = self._unfurl
|
158
|
+
|
159
|
+
attch = { test: 'thing' }
|
160
|
+
|
161
|
+
message 'test'
|
162
|
+
channel '#test'
|
163
|
+
username 'test'
|
164
|
+
icon 'http://a.fake.url'
|
165
|
+
attachment attch
|
166
|
+
attachment attch
|
167
|
+
unfurl true
|
168
|
+
end
|
169
|
+
|
170
|
+
step.configure
|
171
|
+
|
172
|
+
# Run it twice - the first time sets values
|
173
|
+
step.run
|
174
|
+
step.run
|
175
|
+
|
176
|
+
expect(username).to be_nil
|
177
|
+
expect(message).to be_nil
|
178
|
+
expect(icon).to be_nil
|
179
|
+
expect(icon_type).to be_nil
|
180
|
+
expect(attachments).to be_nil
|
181
|
+
expect(unf).to be_nil
|
182
|
+
end
|
142
183
|
end
|