cinch-hangouts 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cinch/plugins/hangouts/hangout.rb +3 -5
- data/lib/cinch/plugins/hangouts/version.rb +1 -1
- data/spec/cinch-hangouts_spec.rb +24 -13
- 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: d59472f61e3eb012d61ac319e212dd3f2efc1bfb
|
4
|
+
data.tar.gz: 423e18cda5f5dc8e2557844af72449000055d57a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f5a1378fce4ab7bf4c9da05605d33091461f017910fcc57a97986a4a7d8c344155fb1f87377ec4980c0e5aa9fb6485262dd118cd072472232ff9dea3bdac6482
|
7
|
+
data.tar.gz: 41b3614c4d71c23ab7de801e608afc80304dbfafecc6fd89bb26afa47fb34e68f7d276433cbc410bae6d003ea8a67e12b89b1bef7d2b2bdccfecc9181b8ca96b
|
@@ -41,16 +41,14 @@ class Hangout < Cinch::Plugins::Hangouts
|
|
41
41
|
read_file(files).data[:hangouts]
|
42
42
|
end
|
43
43
|
|
44
|
-
def self.url(id
|
45
|
-
|
46
|
-
return url unless shorten
|
47
|
-
Cinch::Toolbox.shorten(url)
|
44
|
+
def self.url(id)
|
45
|
+
"https://plus.google.com/hangouts/_/#{id}"
|
48
46
|
end
|
49
47
|
|
50
48
|
private
|
51
49
|
|
52
50
|
def self.read_file(files)
|
53
|
-
fail "No Hangout filename passed" unless files.key?(:hangouts)
|
51
|
+
fail "No Hangout filename passed" unless files.key?(:hangouts)
|
54
52
|
storage = Cinch::Storage.new(files[:hangouts])
|
55
53
|
unless storage.data[:hangouts]
|
56
54
|
storage.data[:hangouts] = {}
|
data/spec/cinch-hangouts_spec.rb
CHANGED
@@ -19,16 +19,16 @@ describe Cinch::Plugins::Hangouts do
|
|
19
19
|
|
20
20
|
describe 'posting a valid hangout link' do
|
21
21
|
it 'captures the the link and stores it in @storage' do
|
22
|
-
msg = make_message(@bot, Hangout.url(random_hangout_id
|
23
|
-
sleep 2
|
22
|
+
msg = make_message(@bot, Hangout.url(random_hangout_id), { channel: '#foo' })
|
24
23
|
get_replies(msg)
|
24
|
+
sleep 2
|
25
25
|
reply = get_replies(make_message(@bot, '!hangouts')).last.text
|
26
26
|
expect(reply).to include('test started a hangout at')
|
27
27
|
expect(reply).to match(/it was last linked \d seconds? ago/)
|
28
28
|
end
|
29
29
|
|
30
30
|
it 'captures even if it has trailing params' do
|
31
|
-
msg = make_message(@bot, Hangout.url(random_hangout_id + '?hl=en'
|
31
|
+
msg = make_message(@bot, Hangout.url(random_hangout_id + '?hl=en'),
|
32
32
|
{ channel: '#foo' })
|
33
33
|
get_replies(msg)
|
34
34
|
sleep 2 # hack until 'time-lord' fix gets released
|
@@ -40,7 +40,7 @@ describe Cinch::Plugins::Hangouts do
|
|
40
40
|
|
41
41
|
it 'recaptures a link' do
|
42
42
|
id = random_hangout_id
|
43
|
-
msg = make_message(@bot, Hangout.url(id
|
43
|
+
msg = make_message(@bot, Hangout.url(id), { channel: '#foo' })
|
44
44
|
get_replies(msg)
|
45
45
|
sleep 2 # hack until 'time-lord' fix gets released
|
46
46
|
get_replies(msg)
|
@@ -50,7 +50,7 @@ describe Cinch::Plugins::Hangouts do
|
|
50
50
|
end
|
51
51
|
|
52
52
|
it 'capture a new short Hangout link and store it in @storage' do
|
53
|
-
msg = make_message(@bot, Hangout.url('7acpjrpcmgl00u0b665mu25b1g'
|
53
|
+
msg = make_message(@bot, Hangout.url('7acpjrpcmgl00u0b665mu25b1g'), { channel: '#foo' })
|
54
54
|
expect(get_replies(msg)).to be_empty
|
55
55
|
sleep 2 # hack until 'time-lord' fix gets released
|
56
56
|
msg = make_message(@bot, '!hangouts')
|
@@ -58,12 +58,25 @@ describe Cinch::Plugins::Hangouts do
|
|
58
58
|
expect(reply).to include('test started a hangout at')
|
59
59
|
expect(reply).to match(/it was last linked \d seconds? ago/)
|
60
60
|
end
|
61
|
+
|
62
|
+
|
63
|
+
it 'capture a link and return it' do
|
64
|
+
url = Hangout.url(random_hangout_id)
|
65
|
+
msg = make_message(@bot, url, { channel: '#foo' })
|
66
|
+
expect(get_replies(msg)).to be_empty
|
67
|
+
sleep 2 # hack until 'time-lord' fix gets released
|
68
|
+
msg = make_message(@bot, '!hangouts')
|
69
|
+
reply = get_replies(msg).last.text
|
70
|
+
expect(reply).to include(url)
|
71
|
+
puts reply
|
72
|
+
# expect(reply).to match(/it was last linked \d seconds? ago/)
|
73
|
+
end
|
61
74
|
end
|
62
75
|
|
63
76
|
describe 'posting an invalid hangout link does not log' do
|
64
77
|
it 'when it is malformed (invalid chars)' do
|
65
|
-
msg = make_message(@bot, Hangout.url('82b5cc7f76b7a%19c180416c2f509027!!d8856d',
|
66
|
-
|
78
|
+
msg = make_message(@bot, Hangout.url('82b5cc7f76b7a%19c180416c2f509027!!d8856d'),
|
79
|
+
{ channel: '#foo' })
|
67
80
|
expect(get_replies(msg)).to be_empty
|
68
81
|
msg = make_message(@bot, '!hangouts')
|
69
82
|
message = get_replies(msg).first.text
|
@@ -71,7 +84,7 @@ describe Cinch::Plugins::Hangouts do
|
|
71
84
|
end
|
72
85
|
|
73
86
|
it 'when it is malformed (wrong length)' do
|
74
|
-
msg = make_message(@bot, Hangout.url('82b5cc'
|
87
|
+
msg = make_message(@bot, Hangout.url('82b5cc'), { channel: '#foo' })
|
75
88
|
expect(get_replies(msg)).to be_empty
|
76
89
|
msg = make_message(@bot, '!hangouts')
|
77
90
|
expect(get_replies(msg).first.text).to eq('No hangouts have been linked recently!')
|
@@ -108,18 +121,16 @@ describe Cinch::Plugins::Hangouts do
|
|
108
121
|
|
109
122
|
#it 'should notify users when a new hangout is linked' do
|
110
123
|
# get_replies(make_message(@bot, '!hangouts subscribe'), { channel: '#foo', nick: 'joe' } )
|
111
|
-
# msgs = get_replies(make_message(@bot, Hangout.url(random_hangout_id
|
124
|
+
# msgs = get_replies(make_message(@bot, Hangout.url(random_hangout_id), { channel: '#foo', nick: 'josh' }))
|
112
125
|
# msgs.first.should_not be_nil
|
113
126
|
#end
|
114
127
|
|
115
128
|
it 'should not notify users when an old hangout is relinked' do
|
116
129
|
get_replies(make_message(@bot, '!hangouts subscribe'), { channel: '#foo' } )
|
117
|
-
get_replies(make_message(@bot, Hangout.url(random_hangout_id
|
118
|
-
msg = make_message(@bot, Hangout.url(random_hangout_id
|
130
|
+
get_replies(make_message(@bot, Hangout.url(random_hangout_id), { channel: '#foo' }))
|
131
|
+
msg = make_message(@bot, Hangout.url(random_hangout_id), { channel: '#foo' })
|
119
132
|
expect(get_replies(msg)).to be_empty
|
120
133
|
end
|
121
|
-
|
122
|
-
|
123
134
|
end
|
124
135
|
|
125
136
|
def random_hangout_id(len = 27)
|