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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bb3171272177bd57c83136502ab62ecd176a9a0f
4
- data.tar.gz: 414f282b050664a3c1bd52399f0f20f9ed918705
3
+ metadata.gz: 658012ae74ae71ac2c98d20806723256d045224a
4
+ data.tar.gz: d4677b9f68af36119b758b639bef9f936b1b9b7a
5
5
  SHA512:
6
- metadata.gz: 576df515bcfba1373f7e4d9d46767d18439f02bbf534c0206d39bff540fa6848e138ebb36397a6fec54e1ac8edc6b92307ac435c666da7922e5a3acae1f81690
7
- data.tar.gz: 92fd5604ab64c8b8a15c4d77ec774eb7a23b736021d59d69d243fa26ef44f0fc6bfd1931dc47c8c6689f4546f80d3fde8772b1a9a73a55375c0220060ada2cde
6
+ metadata.gz: f0f5e83d54726f31a07c9e85c71d97576c69caba6019ddd5766bdc59bd1f647d58b3afd1bab42d76b891c122dd3646b76fd3f939e6cf3bce7f692468ea241cb0
7
+ data.tar.gz: f31d224af9df3cbf7403ab9070c1c298f04275ec38f4e47b6f637f85677ae30b27b38211c7141f605ca6616082682aa932a3c72ea2569d627435a3c23da3f0fb
@@ -1,5 +1,5 @@
1
1
  module Pushpop
2
2
  class Slack
3
- VERSION = '0.2.1'
3
+ VERSION = '0.2.2'
4
4
  end
5
5
  end
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
- unless _message
27
- raise 'Please set the message to send to Slack'
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
- notifier = ::Slack::Notifier.new WEBHOOK_URL
36
+ unless WEBHOOK_URL.nil? || WEBHOOK_URL.empty?
37
+ notifier = ::Slack::Notifier.new WEBHOOK_URL
37
38
 
38
- notifier.ping _message, options
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
@@ -1,11 +1,26 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Pushpop::Slack do
4
- it 'should make sure there is a message' do
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{step.run}.to raise_error
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.1
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-06 00:00:00.000000000 Z
11
+ date: 2015-05-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pushpop