punchblock 2.5.2 → 2.5.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.hound.yml +2 -0
- data/CHANGELOG.md +6 -0
- data/README.markdown +2 -1
- data/lib/punchblock/translator/asterisk/call.rb +3 -3
- data/lib/punchblock/translator/asterisk/component/mrcp_recog_prompt.rb +15 -9
- data/lib/punchblock/translator/asterisk/component/output.rb +8 -1
- data/lib/punchblock/translator/input_component.rb +2 -0
- data/lib/punchblock/version.rb +1 -1
- data/punchblock.gemspec +1 -1
- data/spec/punchblock/client/component_registry_spec.rb +3 -3
- data/spec/punchblock/client_spec.rb +22 -15
- data/spec/punchblock/command/accept_spec.rb +17 -7
- data/spec/punchblock/command/answer_spec.rb +19 -9
- data/spec/punchblock/command/dial_spec.rb +76 -27
- data/spec/punchblock/command/hangup_spec.rb +17 -7
- data/spec/punchblock/command/join_spec.rb +78 -24
- data/spec/punchblock/command/mute_spec.rb +3 -3
- data/spec/punchblock/command/redirect_spec.rb +33 -12
- data/spec/punchblock/command/reject_spec.rb +41 -14
- data/spec/punchblock/command/unjoin_spec.rb +29 -12
- data/spec/punchblock/command/unmute_spec.rb +3 -3
- data/spec/punchblock/command_node_spec.rb +43 -20
- data/spec/punchblock/component/asterisk/agi/command_spec.rb +52 -12
- data/spec/punchblock/component/asterisk/ami/action_spec.rb +69 -21
- data/spec/punchblock/component/component_node_spec.rb +12 -12
- data/spec/punchblock/component/input_spec.rb +304 -87
- data/spec/punchblock/component/output_spec.rb +434 -173
- data/spec/punchblock/component/prompt_spec.rb +63 -20
- data/spec/punchblock/component/receive_fax_spec.rb +43 -14
- data/spec/punchblock/component/record_spec.rb +215 -71
- data/spec/punchblock/component/send_fax_spec.rb +54 -15
- data/spec/punchblock/connection/asterisk_spec.rb +34 -24
- data/spec/punchblock/connection/freeswitch_spec.rb +9 -9
- data/spec/punchblock/connection/xmpp_spec.rb +92 -83
- data/spec/punchblock/event/answered_spec.rb +14 -4
- data/spec/punchblock/event/asterisk/ami/event_spec.rb +34 -12
- data/spec/punchblock/event/complete_spec.rb +36 -16
- data/spec/punchblock/event/dtmf_spec.rb +9 -3
- data/spec/punchblock/event/end_spec.rb +43 -10
- data/spec/punchblock/event/input_timers_started_spec.rb +1 -1
- data/spec/punchblock/event/joined_spec.rb +29 -7
- data/spec/punchblock/event/offer_spec.rb +41 -10
- data/spec/punchblock/event/ringing_spec.rb +14 -4
- data/spec/punchblock/event/started_speaking_spec.rb +9 -3
- data/spec/punchblock/event/stopped_speaking_spec.rb +9 -3
- data/spec/punchblock/event/unjoined_spec.rb +24 -6
- data/spec/punchblock/protocol_error_spec.rb +16 -13
- data/spec/punchblock/ref_spec.rb +90 -26
- data/spec/punchblock/translator/asterisk/call_spec.rb +176 -161
- data/spec/punchblock/translator/asterisk/component/asterisk/agi_command_spec.rb +18 -18
- data/spec/punchblock/translator/asterisk/component/asterisk/ami_action_spec.rb +9 -9
- data/spec/punchblock/translator/asterisk/component/composed_prompt_spec.rb +14 -14
- data/spec/punchblock/translator/asterisk/component/input_spec.rb +57 -36
- data/spec/punchblock/translator/asterisk/component/mrcp_native_prompt_spec.rb +50 -50
- data/spec/punchblock/translator/asterisk/component/mrcp_prompt_spec.rb +59 -48
- data/spec/punchblock/translator/asterisk/component/output_spec.rb +231 -221
- data/spec/punchblock/translator/asterisk/component/record_spec.rb +82 -82
- data/spec/punchblock/translator/asterisk/component/stop_by_redirect_spec.rb +10 -10
- data/spec/punchblock/translator/asterisk/component_spec.rb +4 -4
- data/spec/punchblock/translator/asterisk_spec.rb +89 -82
- data/spec/punchblock/translator/freeswitch/call_spec.rb +114 -99
- data/spec/punchblock/translator/freeswitch/component/flite_output_spec.rb +19 -19
- data/spec/punchblock/translator/freeswitch/component/input_spec.rb +24 -24
- data/spec/punchblock/translator/freeswitch/component/output_spec.rb +23 -23
- data/spec/punchblock/translator/freeswitch/component/record_spec.rb +78 -78
- data/spec/punchblock/translator/freeswitch/component/tts_output_spec.rb +19 -19
- data/spec/punchblock/translator/freeswitch/component_spec.rb +8 -8
- data/spec/punchblock/translator/freeswitch_spec.rb +66 -59
- data/spec/punchblock/uri_list_spec.rb +45 -10
- data/spec/punchblock_spec.rb +13 -13
- data/spec/spec_helper.rb +18 -11
- data/spec/support/mock_connection_with_event_handler.rb +1 -1
- metadata +5 -4
@@ -6,7 +6,7 @@ module Punchblock
|
|
6
6
|
module Component
|
7
7
|
describe Input do
|
8
8
|
it 'registers itself' do
|
9
|
-
RayoNode.class_from_registration(:input, 'urn:xmpp:rayo:input:1').
|
9
|
+
expect(RayoNode.class_from_registration(:input, 'urn:xmpp:rayo:input:1')).to eq(described_class)
|
10
10
|
end
|
11
11
|
|
12
12
|
describe "when setting options in initializer" do
|
@@ -23,16 +23,55 @@ module Punchblock
|
|
23
23
|
:min_confidence => 0.5
|
24
24
|
end
|
25
25
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
26
|
+
describe '#grammars' do
|
27
|
+
subject { super().grammars }
|
28
|
+
it { should be == [Input::Grammar.new(:value => '[5 DIGITS]', :content_type => 'application/grammar+custom')] }
|
29
|
+
end
|
30
|
+
|
31
|
+
describe '#mode' do
|
32
|
+
subject { super().mode }
|
33
|
+
it { should be == :voice }
|
34
|
+
end
|
35
|
+
|
36
|
+
describe '#terminator' do
|
37
|
+
subject { super().terminator }
|
38
|
+
it { should be == '#' }
|
39
|
+
end
|
40
|
+
|
41
|
+
describe '#max_silence' do
|
42
|
+
subject { super().max_silence }
|
43
|
+
it { should be == 1000 }
|
44
|
+
end
|
45
|
+
|
46
|
+
describe '#recognizer' do
|
47
|
+
subject { super().recognizer }
|
48
|
+
it { should be == 'default' }
|
49
|
+
end
|
50
|
+
|
51
|
+
describe '#language' do
|
52
|
+
subject { super().language }
|
53
|
+
it { should be == 'en-US' }
|
54
|
+
end
|
55
|
+
|
56
|
+
describe '#initial_timeout' do
|
57
|
+
subject { super().initial_timeout }
|
58
|
+
it { should be == 2000 }
|
59
|
+
end
|
60
|
+
|
61
|
+
describe '#inter_digit_timeout' do
|
62
|
+
subject { super().inter_digit_timeout }
|
63
|
+
it { should be == 2000 }
|
64
|
+
end
|
65
|
+
|
66
|
+
describe '#sensitivity' do
|
67
|
+
subject { super().sensitivity }
|
68
|
+
it { should be == 0.5 }
|
69
|
+
end
|
70
|
+
|
71
|
+
describe '#min_confidence' do
|
72
|
+
subject { super().min_confidence }
|
73
|
+
it { should be == 0.5 }
|
74
|
+
end
|
36
75
|
|
37
76
|
context "with multiple grammars" do
|
38
77
|
subject do
|
@@ -42,44 +81,50 @@ module Punchblock
|
|
42
81
|
]
|
43
82
|
end
|
44
83
|
|
45
|
-
|
84
|
+
describe '#grammars' do
|
85
|
+
subject { super().grammars }
|
86
|
+
it { should be == [
|
46
87
|
Input::Grammar.new(:value => '[5 DIGITS]', :content_type => 'application/grammar+custom'),
|
47
88
|
Input::Grammar.new(:value => '[10 DIGITS]', :content_type => 'application/grammar+custom')
|
48
89
|
]}
|
90
|
+
end
|
49
91
|
end
|
50
92
|
|
51
93
|
context "with a nil grammar" do
|
52
94
|
it "removes all grammars" do
|
53
95
|
subject.grammar = nil
|
54
|
-
subject.grammars.
|
96
|
+
expect(subject.grammars).to eq([])
|
55
97
|
end
|
56
98
|
end
|
57
99
|
|
58
100
|
context "without any grammars" do
|
59
101
|
subject { described_class.new }
|
60
102
|
|
61
|
-
|
103
|
+
describe '#grammars' do
|
104
|
+
subject { super().grammars }
|
105
|
+
it { should == [] }
|
106
|
+
end
|
62
107
|
end
|
63
108
|
|
64
109
|
describe "exporting to Rayo" do
|
65
110
|
it "should export to XML that can be understood by its parser" do
|
66
111
|
new_instance = RayoNode.from_xml subject.to_rayo
|
67
|
-
new_instance.
|
68
|
-
new_instance.grammars.
|
69
|
-
new_instance.mode.
|
70
|
-
new_instance.terminator.
|
71
|
-
new_instance.max_silence.
|
72
|
-
new_instance.recognizer.
|
73
|
-
new_instance.language.
|
74
|
-
new_instance.initial_timeout.
|
75
|
-
new_instance.inter_digit_timeout.
|
76
|
-
new_instance.sensitivity.
|
77
|
-
new_instance.min_confidence.
|
112
|
+
expect(new_instance).to be_instance_of described_class
|
113
|
+
expect(new_instance.grammars).to eq([Input::Grammar.new(value: '[5 DIGITS]', content_type: 'application/grammar+custom')])
|
114
|
+
expect(new_instance.mode).to eq(:voice)
|
115
|
+
expect(new_instance.terminator).to eq('#')
|
116
|
+
expect(new_instance.max_silence).to eq(1000)
|
117
|
+
expect(new_instance.recognizer).to eq('default')
|
118
|
+
expect(new_instance.language).to eq('en-US')
|
119
|
+
expect(new_instance.initial_timeout).to eq(2000)
|
120
|
+
expect(new_instance.inter_digit_timeout).to eq(2000)
|
121
|
+
expect(new_instance.sensitivity).to eq(0.5)
|
122
|
+
expect(new_instance.min_confidence).to eq(0.5)
|
78
123
|
end
|
79
124
|
|
80
125
|
it "should wrap the grammar value in CDATA" do
|
81
126
|
grammar_node = subject.to_rayo.at_xpath('ns:grammar', ns: described_class.registered_ns)
|
82
|
-
grammar_node.children.first.
|
127
|
+
expect(grammar_node.children.first).to be_a Nokogiri::XML::CDATA
|
83
128
|
end
|
84
129
|
|
85
130
|
it "should render to a parent node if supplied" do
|
@@ -87,7 +132,7 @@ module Punchblock
|
|
87
132
|
parent = Nokogiri::XML::Node.new 'foo', doc
|
88
133
|
doc.root = parent
|
89
134
|
rayo_doc = subject.to_rayo(parent)
|
90
|
-
rayo_doc.
|
135
|
+
expect(rayo_doc).to eq(parent)
|
91
136
|
end
|
92
137
|
end
|
93
138
|
end
|
@@ -119,20 +164,63 @@ module Punchblock
|
|
119
164
|
|
120
165
|
it { should be_instance_of Input }
|
121
166
|
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
167
|
+
describe '#grammars' do
|
168
|
+
subject { super().grammars }
|
169
|
+
it { should be == [Input::Grammar.new(:value => '[5 DIGITS]', :content_type => 'application/grammar+custom'), Input::Grammar.new(:value => '[10 DIGITS]', :content_type => 'application/grammar+custom')] }
|
170
|
+
end
|
171
|
+
|
172
|
+
describe '#mode' do
|
173
|
+
subject { super().mode }
|
174
|
+
it { should be == :voice }
|
175
|
+
end
|
176
|
+
|
177
|
+
describe '#terminator' do
|
178
|
+
subject { super().terminator }
|
179
|
+
it { should be == '#' }
|
180
|
+
end
|
181
|
+
|
182
|
+
describe '#max_silence' do
|
183
|
+
subject { super().max_silence }
|
184
|
+
it { should be == 1000 }
|
185
|
+
end
|
186
|
+
|
187
|
+
describe '#recognizer' do
|
188
|
+
subject { super().recognizer }
|
189
|
+
it { should be == 'default' }
|
190
|
+
end
|
191
|
+
|
192
|
+
describe '#language' do
|
193
|
+
subject { super().language }
|
194
|
+
it { should be == 'en-US' }
|
195
|
+
end
|
196
|
+
|
197
|
+
describe '#initial_timeout' do
|
198
|
+
subject { super().initial_timeout }
|
199
|
+
it { should be == 2000 }
|
200
|
+
end
|
201
|
+
|
202
|
+
describe '#inter_digit_timeout' do
|
203
|
+
subject { super().inter_digit_timeout }
|
204
|
+
it { should be == 2000 }
|
205
|
+
end
|
206
|
+
|
207
|
+
describe '#sensitivity' do
|
208
|
+
subject { super().sensitivity }
|
209
|
+
it { should be == 0.5 }
|
210
|
+
end
|
211
|
+
|
212
|
+
describe '#min_confidence' do
|
213
|
+
subject { super().min_confidence }
|
214
|
+
it { should be == 0.5 }
|
215
|
+
end
|
132
216
|
|
133
217
|
context "without any grammars" do
|
134
218
|
let(:stanza) { '<input xmlns="urn:xmpp:rayo:input:1"/>' }
|
135
|
-
|
219
|
+
|
220
|
+
describe '#grammars' do
|
221
|
+
subject { super().grammars }
|
222
|
+
it { should be == [] }
|
223
|
+
end
|
136
224
|
end
|
137
225
|
end
|
138
226
|
|
@@ -149,15 +237,25 @@ module Punchblock
|
|
149
237
|
describe Input::Grammar do
|
150
238
|
describe "when not passing a content type" do
|
151
239
|
subject { Input::Grammar.new :value => grxml_doc }
|
152
|
-
|
240
|
+
|
241
|
+
describe '#content_type' do
|
242
|
+
subject { super().content_type }
|
243
|
+
it { should be == 'application/srgs+xml' }
|
244
|
+
end
|
153
245
|
end
|
154
246
|
|
155
247
|
describe 'with a GRXML grammar' do
|
156
248
|
subject { Input::Grammar.new :value => grxml_doc, :content_type => 'application/srgs+xml' }
|
157
249
|
|
158
|
-
|
250
|
+
describe '#content_type' do
|
251
|
+
subject { super().content_type }
|
252
|
+
it { should be == 'application/srgs+xml' }
|
253
|
+
end
|
159
254
|
|
160
|
-
|
255
|
+
describe '#value' do
|
256
|
+
subject { super().value }
|
257
|
+
it { should be == grxml_doc }
|
258
|
+
end
|
161
259
|
|
162
260
|
describe "comparison" do
|
163
261
|
let(:grammar2) { Input::Grammar.new :value => grxml_doc }
|
@@ -168,7 +266,7 @@ module Punchblock
|
|
168
266
|
end
|
169
267
|
|
170
268
|
it "has children nested inside" do
|
171
|
-
subject.to_rayo.children.first.
|
269
|
+
expect(subject.to_rayo.children.first).to be_a Nokogiri::XML::CDATA
|
172
270
|
end
|
173
271
|
end
|
174
272
|
|
@@ -177,16 +275,23 @@ module Punchblock
|
|
177
275
|
|
178
276
|
subject { Input::Grammar.new :url => url }
|
179
277
|
|
180
|
-
|
181
|
-
|
278
|
+
describe '#url' do
|
279
|
+
subject { super().url }
|
280
|
+
it { should be == url }
|
281
|
+
end
|
282
|
+
|
283
|
+
describe '#content_type' do
|
284
|
+
subject { super().content_type }
|
285
|
+
it { should be nil}
|
286
|
+
end
|
182
287
|
|
183
288
|
describe "comparison" do
|
184
289
|
it "should be the same with the same url" do
|
185
|
-
Input::Grammar.new(:url => url).
|
290
|
+
expect(Input::Grammar.new(:url => url)).to eq(Input::Grammar.new(:url => url))
|
186
291
|
end
|
187
292
|
|
188
293
|
it "should be different with a different url" do
|
189
|
-
Input::Grammar.new(:url => url).
|
294
|
+
expect(Input::Grammar.new(:url => url)).not_to eq(Input::Grammar.new(:url => 'http://doo.com/dah'))
|
190
295
|
end
|
191
296
|
end
|
192
297
|
end
|
@@ -195,7 +300,7 @@ module Punchblock
|
|
195
300
|
subject { Input::Grammar.new url: "urn:xmpp:rayo:cpa:beep:1" }
|
196
301
|
|
197
302
|
it "has no children" do
|
198
|
-
subject.to_rayo.children.count.
|
303
|
+
expect(subject.to_rayo.children.count).to eq(0)
|
199
304
|
end
|
200
305
|
end
|
201
306
|
end
|
@@ -213,9 +318,20 @@ module Punchblock
|
|
213
318
|
describe '#stop_action' do
|
214
319
|
subject { command.stop_action }
|
215
320
|
|
216
|
-
|
217
|
-
|
218
|
-
|
321
|
+
describe '#to_xml' do
|
322
|
+
subject { super().to_xml }
|
323
|
+
it { should be == '<stop xmlns="urn:xmpp:rayo:ext:1"/>' }
|
324
|
+
end
|
325
|
+
|
326
|
+
describe '#component_id' do
|
327
|
+
subject { super().component_id }
|
328
|
+
it { should be == 'abc123' }
|
329
|
+
end
|
330
|
+
|
331
|
+
describe '#target_call_id' do
|
332
|
+
subject { super().target_call_id }
|
333
|
+
it { should be == '123abc' }
|
334
|
+
end
|
219
335
|
end
|
220
336
|
|
221
337
|
describe '#stop!' do
|
@@ -226,14 +342,14 @@ module Punchblock
|
|
226
342
|
end
|
227
343
|
|
228
344
|
it "should send its command properly" do
|
229
|
-
mock_client.
|
345
|
+
expect(mock_client).to receive(:execute_command).with(command.stop_action, :target_call_id => '123abc', :component_id => 'abc123')
|
230
346
|
command.stop!
|
231
347
|
end
|
232
348
|
end
|
233
349
|
|
234
350
|
describe "when the command is not executing" do
|
235
351
|
it "should raise an error" do
|
236
|
-
|
352
|
+
expect { command.stop! }.to raise_error(InvalidActionError, "Cannot stop a Input that is new")
|
237
353
|
end
|
238
354
|
end
|
239
355
|
end
|
@@ -281,25 +397,75 @@ module Punchblock
|
|
281
397
|
|
282
398
|
it { should be_instance_of Input::Complete::Match }
|
283
399
|
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
400
|
+
describe '#name' do
|
401
|
+
subject { super().name }
|
402
|
+
it { should be == :match }
|
403
|
+
end
|
404
|
+
|
405
|
+
describe '#content_type' do
|
406
|
+
subject { super().content_type }
|
407
|
+
it { should be == 'application/nlsml+xml' }
|
408
|
+
end
|
409
|
+
|
410
|
+
describe '#nlsml' do
|
411
|
+
subject { super().nlsml }
|
412
|
+
it { should be == expected_nlsml }
|
413
|
+
end
|
414
|
+
|
415
|
+
describe '#mode' do
|
416
|
+
subject { super().mode }
|
417
|
+
it { should be == :voice }
|
418
|
+
end
|
419
|
+
|
420
|
+
describe '#confidence' do
|
421
|
+
subject { super().confidence }
|
422
|
+
it { should be == 0.6 }
|
423
|
+
end
|
424
|
+
|
425
|
+
describe '#interpretation' do
|
426
|
+
subject { super().interpretation }
|
427
|
+
it { should be == { airline: { to_city: 'Pittsburgh' } } }
|
428
|
+
end
|
429
|
+
|
430
|
+
describe '#utterance' do
|
431
|
+
subject { super().utterance }
|
432
|
+
it { should be == 'I want to go to Pittsburgh' }
|
433
|
+
end
|
291
434
|
|
292
435
|
describe "when creating from an NLSML document" do
|
293
436
|
subject do
|
294
437
|
Input::Complete::Match.new :nlsml => expected_nlsml
|
295
438
|
end
|
296
439
|
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
440
|
+
describe '#content_type' do
|
441
|
+
subject { super().content_type }
|
442
|
+
it { should be == 'application/nlsml+xml' }
|
443
|
+
end
|
444
|
+
|
445
|
+
describe '#nlsml' do
|
446
|
+
subject { super().nlsml }
|
447
|
+
it { should be == expected_nlsml }
|
448
|
+
end
|
449
|
+
|
450
|
+
describe '#mode' do
|
451
|
+
subject { super().mode }
|
452
|
+
it { should be == :voice }
|
453
|
+
end
|
454
|
+
|
455
|
+
describe '#confidence' do
|
456
|
+
subject { super().confidence }
|
457
|
+
it { should be == 0.6 }
|
458
|
+
end
|
459
|
+
|
460
|
+
describe '#interpretation' do
|
461
|
+
subject { super().interpretation }
|
462
|
+
it { should be == { airline: { to_city: 'Pittsburgh' } } }
|
463
|
+
end
|
464
|
+
|
465
|
+
describe '#utterance' do
|
466
|
+
subject { super().utterance }
|
467
|
+
it { should be == 'I want to go to Pittsburgh' }
|
468
|
+
end
|
303
469
|
end
|
304
470
|
|
305
471
|
context "when not enclosed in CDATA, but escaped" do
|
@@ -314,7 +480,7 @@ module Punchblock
|
|
314
480
|
end
|
315
481
|
|
316
482
|
it "should parse the NLSML correctly" do
|
317
|
-
subject.nlsml.grammar.
|
483
|
+
expect(subject.nlsml.grammar).to eq("http://flight")
|
318
484
|
end
|
319
485
|
end
|
320
486
|
|
@@ -330,14 +496,14 @@ module Punchblock
|
|
330
496
|
end
|
331
497
|
|
332
498
|
it "should parse the NLSML correctly" do
|
333
|
-
subject.nlsml.grammar.
|
499
|
+
expect(subject.nlsml.grammar).to eq("http://flight")
|
334
500
|
end
|
335
501
|
end
|
336
502
|
|
337
503
|
describe "comparison" do
|
338
504
|
context "with the same nlsml" do
|
339
505
|
it "should be equal" do
|
340
|
-
subject.
|
506
|
+
expect(subject).to eq(RayoNode.from_xml(parse_stanza(stanza).root).reason)
|
341
507
|
end
|
342
508
|
end
|
343
509
|
|
@@ -353,7 +519,7 @@ module Punchblock
|
|
353
519
|
end
|
354
520
|
|
355
521
|
it "should not be equal" do
|
356
|
-
subject.
|
522
|
+
expect(subject).not_to eq(RayoNode.from_xml(parse_stanza(other_stanza).root).reason)
|
357
523
|
end
|
358
524
|
end
|
359
525
|
end
|
@@ -372,7 +538,10 @@ module Punchblock
|
|
372
538
|
|
373
539
|
it { should be_instance_of Input::Complete::NoMatch }
|
374
540
|
|
375
|
-
|
541
|
+
describe '#name' do
|
542
|
+
subject { super().name }
|
543
|
+
it { should be == :nomatch }
|
544
|
+
end
|
376
545
|
end
|
377
546
|
|
378
547
|
describe Input::Complete::NoInput do
|
@@ -388,7 +557,10 @@ module Punchblock
|
|
388
557
|
|
389
558
|
it { should be_instance_of Input::Complete::NoInput }
|
390
559
|
|
391
|
-
|
560
|
+
describe '#name' do
|
561
|
+
subject { super().name }
|
562
|
+
it { should be == :noinput }
|
563
|
+
end
|
392
564
|
end
|
393
565
|
|
394
566
|
describe Input::Signal do
|
@@ -403,20 +575,50 @@ module Punchblock
|
|
403
575
|
it { should be_instance_of Input::Signal }
|
404
576
|
it { should be_a Punchblock::Event }
|
405
577
|
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
578
|
+
describe '#name' do
|
579
|
+
subject { super().name }
|
580
|
+
it { should be == :signal }
|
581
|
+
end
|
582
|
+
|
583
|
+
describe '#type' do
|
584
|
+
subject { super().type }
|
585
|
+
it { should be == 'urn:xmpp:rayo:cpa:beep:1' }
|
586
|
+
end
|
587
|
+
|
588
|
+
describe '#duration' do
|
589
|
+
subject { super().duration }
|
590
|
+
it { should be == 1000 }
|
591
|
+
end
|
592
|
+
|
593
|
+
describe '#value' do
|
594
|
+
subject { super().value }
|
595
|
+
it { should be == '8000' }
|
596
|
+
end
|
410
597
|
|
411
598
|
describe "when creating from options" do
|
412
599
|
subject do
|
413
600
|
Input::Signal.new type: 'urn:xmpp:rayo:cpa:beep:1', duration: 1000, value: '8000'
|
414
601
|
end
|
415
602
|
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
603
|
+
describe '#name' do
|
604
|
+
subject { super().name }
|
605
|
+
it { should be == :signal }
|
606
|
+
end
|
607
|
+
|
608
|
+
describe '#type' do
|
609
|
+
subject { super().type }
|
610
|
+
it { should be == 'urn:xmpp:rayo:cpa:beep:1' }
|
611
|
+
end
|
612
|
+
|
613
|
+
describe '#duration' do
|
614
|
+
subject { super().duration }
|
615
|
+
it { should be == 1000 }
|
616
|
+
end
|
617
|
+
|
618
|
+
describe '#value' do
|
619
|
+
subject { super().value }
|
620
|
+
it { should be == '8000' }
|
621
|
+
end
|
420
622
|
end
|
421
623
|
|
422
624
|
context "when in a complete event" do
|
@@ -432,16 +634,31 @@ module Punchblock
|
|
432
634
|
|
433
635
|
it { should be_instance_of Input::Signal }
|
434
636
|
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
637
|
+
describe '#name' do
|
638
|
+
subject { super().name }
|
639
|
+
it { should be == :signal }
|
640
|
+
end
|
641
|
+
|
642
|
+
describe '#type' do
|
643
|
+
subject { super().type }
|
644
|
+
it { should be == 'urn:xmpp:rayo:cpa:beep:1' }
|
645
|
+
end
|
646
|
+
|
647
|
+
describe '#duration' do
|
648
|
+
subject { super().duration }
|
649
|
+
it { should be == 1000 }
|
650
|
+
end
|
651
|
+
|
652
|
+
describe '#value' do
|
653
|
+
subject { super().value }
|
654
|
+
it { should be == '8000' }
|
655
|
+
end
|
439
656
|
end
|
440
657
|
|
441
658
|
describe "comparison" do
|
442
659
|
context "with the same options" do
|
443
660
|
it "should be equal" do
|
444
|
-
subject.
|
661
|
+
expect(subject).to eq(RayoNode.from_xml(parse_stanza(stanza).root))
|
445
662
|
end
|
446
663
|
end
|
447
664
|
|
@@ -449,7 +666,7 @@ module Punchblock
|
|
449
666
|
let(:other_stanza) { '<signal xmlns="urn:xmpp:rayo:cpa:1" type="urn:xmpp:rayo:cpa:ring:1" duration="1000" value="8000"/>' }
|
450
667
|
|
451
668
|
it "should not be equal" do
|
452
|
-
subject.
|
669
|
+
expect(subject).not_to eq(RayoNode.from_xml(parse_stanza(other_stanza).root))
|
453
670
|
end
|
454
671
|
end
|
455
672
|
|
@@ -457,7 +674,7 @@ module Punchblock
|
|
457
674
|
let(:other_stanza) { '<signal xmlns="urn:xmpp:rayo:cpa:1" type="urn:xmpp:rayo:cpa:beep:1" duration="100" value="8000"/>' }
|
458
675
|
|
459
676
|
it "should not be equal" do
|
460
|
-
subject.
|
677
|
+
expect(subject).not_to eq(RayoNode.from_xml(parse_stanza(other_stanza).root))
|
461
678
|
end
|
462
679
|
end
|
463
680
|
|
@@ -465,7 +682,7 @@ module Punchblock
|
|
465
682
|
let(:other_stanza) { '<signal xmlns="urn:xmpp:rayo:cpa:1" type="urn:xmpp:rayo:cpa:beep:1" duration="1000" value="7000"/>' }
|
466
683
|
|
467
684
|
it "should not be equal" do
|
468
|
-
subject.
|
685
|
+
expect(subject).not_to eq(RayoNode.from_xml(parse_stanza(other_stanza).root))
|
469
686
|
end
|
470
687
|
end
|
471
688
|
end
|