pushpop-slack 0.2.1 → 0.2.2
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/version.rb +1 -1
- data/lib/pushpop-slack.rb +10 -6
- data/spec/pushpop-slack_spec.rb +17 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 658012ae74ae71ac2c98d20806723256d045224a
|
4
|
+
data.tar.gz: d4677b9f68af36119b758b639bef9f936b1b9b7a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f0f5e83d54726f31a07c9e85c71d97576c69caba6019ddd5766bdc59bd1f647d58b3afd1bab42d76b891c122dd3646b76fd3f939e6cf3bce7f692468ea241cb0
|
7
|
+
data.tar.gz: f31d224af9df3cbf7403ab9070c1c298f04275ec38f4e47b6f637f85677ae30b27b38211c7141f605ca6616082682aa932a3c72ea2569d627435a3c23da3f0fb
|
data/lib/pushpop-slack.rb
CHANGED
@@ -23,19 +23,23 @@ module Pushpop
|
|
23
23
|
|
24
24
|
ret = configure(last_response, step_responses)
|
25
25
|
|
26
|
-
|
27
|
-
|
26
|
+
if _message
|
27
|
+
send_message
|
28
|
+
else
|
29
|
+
Pushpop.logger.debug("No slack message sent - message was not set")
|
28
30
|
end
|
29
31
|
|
30
|
-
send_message
|
31
|
-
|
32
32
|
ret
|
33
33
|
end
|
34
34
|
|
35
35
|
def send_message
|
36
|
-
|
36
|
+
unless WEBHOOK_URL.nil? || WEBHOOK_URL.empty?
|
37
|
+
notifier = ::Slack::Notifier.new WEBHOOK_URL
|
37
38
|
|
38
|
-
|
39
|
+
notifier.ping _message, options
|
40
|
+
else
|
41
|
+
Pushpop.logger.debug("Could not send slack message - SLACK_WEBHOOK_URL is nil or empty")
|
42
|
+
end
|
39
43
|
end
|
40
44
|
|
41
45
|
def options
|
data/spec/pushpop-slack_spec.rb
CHANGED
@@ -1,11 +1,26 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Pushpop::Slack do
|
4
|
-
it 'should
|
4
|
+
it 'should not send if there is no message' do
|
5
5
|
step = Pushpop::Slack.new do
|
6
6
|
end
|
7
7
|
|
8
|
-
expect
|
8
|
+
expect(step).not_to receive(:send_message)
|
9
|
+
|
10
|
+
step.configure
|
11
|
+
step.run
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'should send if there is a message' do
|
15
|
+
step = Pushpop::Slack.new do
|
16
|
+
message 'nothing'
|
17
|
+
end
|
18
|
+
|
19
|
+
allow(step).to receive(:send_message)
|
20
|
+
expect(step).to receive(:send_message)
|
21
|
+
|
22
|
+
step.configure
|
23
|
+
step.run
|
9
24
|
end
|
10
25
|
|
11
26
|
it 'should prepend a # to the channel if its not there' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pushpop-slack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joe Wegner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pushpop
|