bearychat-notifier 0.0.4 → 0.0.5
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 +4 -4
- data/.rspec +1 -0
- data/Rakefile +5 -0
- data/bearychat-notifier.gemspec +1 -0
- data/lib/bearychat-notifier.rb +1 -1
- data/lib/bearychat-notifier/http_client.rb +2 -2
- data/lib/bearychat-notifier/version.rb +1 -1
- data/spec/lib/beary-notifier_spec.rb +44 -0
- data/spec/lib/bearychat-notifier/http_client_spec.rb +23 -0
- data/spec/spec_helper.rb +8 -0
- metadata +24 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5fa9b8632f7fc862ba434639e8d432ac87acaeaa
|
4
|
+
data.tar.gz: 06078fb1302702835b2c5eaf8c1cac425878b13f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 637f9195a55dc49e2a50530fb8e91088ba90761ceb64f119ead041de252e44829ab1e79ac316e8539cc9fd7c50e28c2fec921d78bd1fbe32dfaeaaa4d1b41865
|
7
|
+
data.tar.gz: d6de2c766283ed34f84b8d612d9e7a885864bc615e8fd37c1670d26c6eb182c823d4e0af0b15a73f4893172b81105d5654fe2e4e6250ec38e64b520f5a9d1c61
|
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color --format 'documentation'
|
data/Rakefile
CHANGED
data/bearychat-notifier.gemspec
CHANGED
data/lib/bearychat-notifier.rb
CHANGED
@@ -30,8 +30,8 @@ module Bearychat
|
|
30
30
|
socket.use_ssl = true if url.scheme.downcase == "https"
|
31
31
|
|
32
32
|
http_options.each do |opt, val|
|
33
|
-
if
|
34
|
-
|
33
|
+
if socket.respond_to? "#{opt}="
|
34
|
+
socket.send "#{opt}=", val
|
35
35
|
else
|
36
36
|
warn "Net::HTTP doesn't respond to `#{opt}=`, ignoring that option"
|
37
37
|
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Bearychat::Notifier do
|
4
|
+
subject { described_class.new 'http://example.com' }
|
5
|
+
|
6
|
+
describe "#initialize" do
|
7
|
+
it "sets the given hook_url to the webhook_url" do
|
8
|
+
expect( subject.webhook_url ).to eq 'http://example.com'
|
9
|
+
end
|
10
|
+
|
11
|
+
it "sets the defaut options" do
|
12
|
+
subject = described_class.new 'http://example.com', channel: 'all'
|
13
|
+
expect( subject.channel ).to eq 'all'
|
14
|
+
end
|
15
|
+
|
16
|
+
it "#channel=" do
|
17
|
+
subject = described_class.new 'http://example.com', channel: 'all'
|
18
|
+
subject.channel = "general"
|
19
|
+
expect( subject.channel ).to eq 'general'
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe "#ping" do
|
24
|
+
before :each do
|
25
|
+
allow( Bearychat::Notifier::HttpClient ).to receive(:post)
|
26
|
+
end
|
27
|
+
|
28
|
+
context "with a defaut channel set" do
|
29
|
+
before :each do
|
30
|
+
subject.channel = "#defaut"
|
31
|
+
end
|
32
|
+
|
33
|
+
it "does not require a channel to ping" do
|
34
|
+
expect{
|
35
|
+
subject.ping "the message"
|
36
|
+
}.not_to raise_error
|
37
|
+
end
|
38
|
+
|
39
|
+
it "allows override channel to be set" do
|
40
|
+
subject.ping "the message", channel: "override"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Bearychat::Notifier::HttpClient do
|
4
|
+
describe ".post" do
|
5
|
+
it "initialize HttpClient with the given uri and params then call" do
|
6
|
+
http_post_double = instance_double("Bearychat::Notifier::HttpClient")
|
7
|
+
expect( described_class ).to receive(:new)
|
8
|
+
.with('uri', 'params')
|
9
|
+
.and_return( http_post_double )
|
10
|
+
|
11
|
+
expect( http_post_double ).to receive( :call )
|
12
|
+
described_class.post 'uri', 'params'
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
describe "#initialize" do
|
17
|
+
it "setting options HttpClient" do
|
18
|
+
http_client = described_class.new('http://example.com/', http_options: { open_timeout: 5 })
|
19
|
+
|
20
|
+
http_client.call
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bearychat-notifier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- villins
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-06-
|
11
|
+
date: 2015-06-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 3.3.0
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 3.3.0
|
41
55
|
description: A simple wrapper for posting to bearychat channels
|
42
56
|
email:
|
43
57
|
- linshao512@gmail.com
|
@@ -46,6 +60,7 @@ extensions: []
|
|
46
60
|
extra_rdoc_files: []
|
47
61
|
files:
|
48
62
|
- ".gitignore"
|
63
|
+
- ".rspec"
|
49
64
|
- Gemfile
|
50
65
|
- LICENSE.txt
|
51
66
|
- README.md
|
@@ -55,6 +70,9 @@ files:
|
|
55
70
|
- lib/bearychat-notifier/http_client.rb
|
56
71
|
- lib/bearychat-notifier/version.rb
|
57
72
|
- lib/exception_notifier/bearychat_notifier.rb
|
73
|
+
- spec/lib/beary-notifier_spec.rb
|
74
|
+
- spec/lib/bearychat-notifier/http_client_spec.rb
|
75
|
+
- spec/spec_helper.rb
|
58
76
|
homepage: ''
|
59
77
|
licenses:
|
60
78
|
- MIT
|
@@ -79,4 +97,7 @@ rubygems_version: 2.4.8
|
|
79
97
|
signing_key:
|
80
98
|
specification_version: 4
|
81
99
|
summary: A simple wrapper for posting to bearychat channels
|
82
|
-
test_files:
|
100
|
+
test_files:
|
101
|
+
- spec/lib/beary-notifier_spec.rb
|
102
|
+
- spec/lib/bearychat-notifier/http_client_spec.rb
|
103
|
+
- spec/spec_helper.rb
|