slack-notifier 0.3.2 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/slack-notifier.rb +8 -0
- data/lib/slack-notifier/version.rb +1 -1
- data/spec/lib/slack-notifier_spec.rb +17 -8
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f1ec45bf7b33fbafc47854195adbd58ef447820
|
4
|
+
data.tar.gz: 5f941b10ca31632805e4029cc432fee25dbe4de6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2869813080b6254ae2bd41124ea10003b2a863721baa26710c4f86c455d15490f37f9660d7486465b11d3a0785c11e24b62f92200de4943ddbc42995a0f10fcb
|
7
|
+
data.tar.gz: 27943e0d35aedeee68ef5576419a4d4cbc79073f1f2ca21ce92a779eadc473f3f993dc289f10c232edb9f03e03d83069e043f678ad515a968eaa99f2c93f3aa5
|
data/lib/slack-notifier.rb
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Slack::Notifier do
|
4
|
+
subject { described_class.new 'team', 'token' }
|
4
5
|
|
5
6
|
describe "#initialize" do
|
6
7
|
it "sets the given team" do
|
7
|
-
subject = described_class.new 'team', 'token'
|
8
8
|
expect( subject.team ).to eq 'team'
|
9
9
|
end
|
10
10
|
|
11
11
|
it "sets the given token" do
|
12
|
-
subject = described_class.new 'team', 'token'
|
13
12
|
expect( subject.token ).to eq 'token'
|
14
13
|
end
|
15
14
|
|
@@ -37,22 +36,21 @@ describe Slack::Notifier do
|
|
37
36
|
@endpoint_double = instance_double "URI::HTTP"
|
38
37
|
allow( URI ).to receive(:parse)
|
39
38
|
.and_return(@endpoint_double)
|
40
|
-
|
41
|
-
@subject.channel = 'default'
|
39
|
+
subject.channel = '#default'
|
42
40
|
end
|
43
41
|
|
44
42
|
it "does not require a channel to ping" do
|
45
43
|
expect{
|
46
|
-
|
44
|
+
subject.ping "the message"
|
47
45
|
}.not_to raise_error
|
48
46
|
end
|
49
47
|
|
50
48
|
it "uses default channel" do
|
51
49
|
expect( Slack::Notifier::HTTPPost ).to receive(:to)
|
52
50
|
.with @endpoint_double,
|
53
|
-
payload: '{"text":"the message","channel":"default"}'
|
51
|
+
payload: '{"text":"the message","channel":"#default"}'
|
54
52
|
|
55
|
-
|
53
|
+
subject.ping "the message"
|
56
54
|
end
|
57
55
|
|
58
56
|
it "allows override channel to be set" do
|
@@ -60,7 +58,7 @@ describe Slack::Notifier do
|
|
60
58
|
.with @endpoint_double,
|
61
59
|
payload: '{"text":"the message","channel":"new"}'
|
62
60
|
|
63
|
-
|
61
|
+
subject.ping "the message", channel: "new"
|
64
62
|
end
|
65
63
|
|
66
64
|
end
|
@@ -96,4 +94,15 @@ describe Slack::Notifier do
|
|
96
94
|
end
|
97
95
|
end
|
98
96
|
|
97
|
+
describe "#channel=" do
|
98
|
+
it "sets the given channel" do
|
99
|
+
subject.channel = "#foo"
|
100
|
+
expect( subject.channel ).to eql "#foo"
|
101
|
+
end
|
102
|
+
|
103
|
+
it "adds # prefix to channel" do
|
104
|
+
subject.channel = "foo"
|
105
|
+
expect( subject.channel ).to eql "#foo"
|
106
|
+
end
|
107
|
+
end
|
99
108
|
end
|
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: slack-notifier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.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: 2014-03-
|
11
|
+
date: 2014-03-28 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description:
|
13
|
+
description: " A slim ruby wrapper for posting to slack webhooks "
|
14
14
|
email:
|
15
15
|
- stevenosloan@gmail.com
|
16
16
|
executables: []
|
@@ -36,12 +36,12 @@ require_paths:
|
|
36
36
|
- lib
|
37
37
|
required_ruby_version: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
|
-
- -
|
39
|
+
- - ">="
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: '0'
|
42
42
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
|
-
- -
|
44
|
+
- - ">="
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: '0'
|
47
47
|
requirements: []
|
@@ -56,3 +56,4 @@ test_files:
|
|
56
56
|
- spec/lib/slack-notifier/link_formatter_spec.rb
|
57
57
|
- spec/lib/slack-notifier_spec.rb
|
58
58
|
- spec/spec_helper.rb
|
59
|
+
has_rdoc:
|