punchblock 2.5.2 → 2.5.3
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/.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 Command
|
|
7
7
|
describe Hangup do
|
|
8
8
|
it 'registers itself' do
|
|
9
|
-
RayoNode.class_from_registration(:hangup, 'urn:xmpp:rayo:1').
|
|
9
|
+
expect(RayoNode.class_from_registration(:hangup, 'urn:xmpp:rayo:1')).to eq(described_class)
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
describe "from a stanza" do
|
|
@@ -22,25 +22,35 @@ module Punchblock
|
|
|
22
22
|
subject { RayoNode.from_xml parse_stanza(stanza).root, '9f00061', '1' }
|
|
23
23
|
|
|
24
24
|
it { should be_instance_of described_class }
|
|
25
|
-
|
|
25
|
+
|
|
26
|
+
describe '#headers' do
|
|
27
|
+
subject { super().headers }
|
|
28
|
+
it { should == { 'X-skill' => 'agent', 'X-customer-id' => '8877' } }
|
|
29
|
+
end
|
|
26
30
|
|
|
27
31
|
context "with no headers provided" do
|
|
28
32
|
let(:stanza) { '<hangup xmlns="urn:xmpp:rayo:1"/>' }
|
|
29
33
|
|
|
30
|
-
|
|
34
|
+
describe '#headers' do
|
|
35
|
+
subject { super().headers }
|
|
36
|
+
it { should == {} }
|
|
37
|
+
end
|
|
31
38
|
end
|
|
32
39
|
end
|
|
33
40
|
|
|
34
41
|
describe "when setting options in initializer" do
|
|
35
42
|
subject { described_class.new headers: { 'X-skill' => 'agent', 'X-customer-id' => '8877' } }
|
|
36
43
|
|
|
37
|
-
|
|
44
|
+
describe '#headers' do
|
|
45
|
+
subject { super().headers }
|
|
46
|
+
it { should == { 'X-skill' => 'agent', 'X-customer-id' => '8877' } }
|
|
47
|
+
end
|
|
38
48
|
|
|
39
49
|
describe "exporting to Rayo" do
|
|
40
50
|
it "should export to XML that can be understood by its parser" do
|
|
41
51
|
new_instance = RayoNode.from_xml subject.to_rayo
|
|
42
|
-
new_instance.
|
|
43
|
-
new_instance.headers.
|
|
52
|
+
expect(new_instance).to be_instance_of described_class
|
|
53
|
+
expect(new_instance.headers).to eq({ 'X-skill' => 'agent', 'X-customer-id' => '8877' })
|
|
44
54
|
end
|
|
45
55
|
|
|
46
56
|
it "should render to a parent node if supplied" do
|
|
@@ -48,7 +58,7 @@ module Punchblock
|
|
|
48
58
|
parent = Nokogiri::XML::Node.new 'foo', doc
|
|
49
59
|
doc.root = parent
|
|
50
60
|
rayo_doc = subject.to_rayo(parent)
|
|
51
|
-
rayo_doc.
|
|
61
|
+
expect(rayo_doc).to eq(parent)
|
|
52
62
|
end
|
|
53
63
|
end
|
|
54
64
|
end
|
|
@@ -6,31 +6,49 @@ module Punchblock
|
|
|
6
6
|
module Command
|
|
7
7
|
describe Join do
|
|
8
8
|
it 'registers itself' do
|
|
9
|
-
RayoNode.class_from_registration(:join, 'urn:xmpp:rayo:1').
|
|
9
|
+
expect(RayoNode.class_from_registration(:join, 'urn:xmpp:rayo:1')).to eq(described_class)
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
describe "when setting options in initializer" do
|
|
13
13
|
subject { described_class.new :call_uri => 'abc123', :mixer_name => 'blah', :direction => :duplex, :media => :bridge }
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
describe '#call_uri' do
|
|
16
|
+
subject { super().call_uri }
|
|
17
|
+
it { should be == 'abc123' }
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
describe '#mixer_name' do
|
|
21
|
+
subject { super().mixer_name }
|
|
22
|
+
it { should be == 'blah' }
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
describe '#direction' do
|
|
26
|
+
subject { super().direction }
|
|
27
|
+
it { should be == :duplex }
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
describe '#media' do
|
|
31
|
+
subject { super().media }
|
|
32
|
+
it { should be == :bridge }
|
|
33
|
+
end
|
|
19
34
|
|
|
20
35
|
context "with old call_id attribute" do
|
|
21
36
|
subject { described_class.new call_id: 'abc123' }
|
|
22
37
|
|
|
23
|
-
|
|
38
|
+
describe '#call_uri' do
|
|
39
|
+
subject { super().call_uri }
|
|
40
|
+
it { should be == 'abc123' }
|
|
41
|
+
end
|
|
24
42
|
end
|
|
25
43
|
|
|
26
44
|
describe "exporting to Rayo" do
|
|
27
45
|
it "should export to XML that can be understood by its parser" do
|
|
28
46
|
new_instance = RayoNode.from_xml subject.to_rayo
|
|
29
|
-
new_instance.
|
|
30
|
-
new_instance.call_uri.
|
|
31
|
-
new_instance.mixer_name.
|
|
32
|
-
new_instance.direction.
|
|
33
|
-
new_instance.media.
|
|
47
|
+
expect(new_instance).to be_instance_of described_class
|
|
48
|
+
expect(new_instance.call_uri).to eq('abc123')
|
|
49
|
+
expect(new_instance.mixer_name).to eq('blah')
|
|
50
|
+
expect(new_instance.direction).to eq(:duplex)
|
|
51
|
+
expect(new_instance.media).to eq(:bridge)
|
|
34
52
|
end
|
|
35
53
|
|
|
36
54
|
it "should render to a parent node if supplied" do
|
|
@@ -38,15 +56,15 @@ module Punchblock
|
|
|
38
56
|
parent = Nokogiri::XML::Node.new 'foo', doc
|
|
39
57
|
doc.root = parent
|
|
40
58
|
rayo_doc = subject.to_rayo(parent)
|
|
41
|
-
rayo_doc.
|
|
59
|
+
expect(rayo_doc).to eq(parent)
|
|
42
60
|
end
|
|
43
61
|
|
|
44
62
|
context "when attributes are not set" do
|
|
45
63
|
subject { described_class.new call_uri: 'abc123' }
|
|
46
64
|
|
|
47
65
|
it "should not include them in the XML representation" do
|
|
48
|
-
subject.to_rayo['call-uri'].
|
|
49
|
-
subject.to_rayo['mixer-name'].
|
|
66
|
+
expect(subject.to_rayo['call-uri']).to eq('abc123')
|
|
67
|
+
expect(subject.to_rayo['mixer-name']).to be_nil
|
|
50
68
|
end
|
|
51
69
|
end
|
|
52
70
|
end
|
|
@@ -67,18 +85,48 @@ module Punchblock
|
|
|
67
85
|
|
|
68
86
|
it { should be_instance_of described_class }
|
|
69
87
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
88
|
+
describe '#call_uri' do
|
|
89
|
+
subject { super().call_uri }
|
|
90
|
+
it { should be == 'abc123' }
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
describe '#mixer_name' do
|
|
94
|
+
subject { super().mixer_name }
|
|
95
|
+
it { should be == 'blah' }
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
describe '#direction' do
|
|
99
|
+
subject { super().direction }
|
|
100
|
+
it { should be == :duplex }
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
describe '#media' do
|
|
104
|
+
subject { super().media }
|
|
105
|
+
it { should be == :bridge }
|
|
106
|
+
end
|
|
74
107
|
|
|
75
108
|
context "when no attributes are set" do
|
|
76
109
|
let(:stanza) { '<join xmlns="urn:xmpp:rayo:1" />' }
|
|
77
110
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
111
|
+
describe '#call_uri' do
|
|
112
|
+
subject { super().call_uri }
|
|
113
|
+
it { should be_nil }
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
describe '#mixer_name' do
|
|
117
|
+
subject { super().mixer_name }
|
|
118
|
+
it { should be_nil }
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
describe '#direction' do
|
|
122
|
+
subject { super().direction }
|
|
123
|
+
it { should be_nil }
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
describe '#media' do
|
|
127
|
+
subject { super().media }
|
|
128
|
+
it { should be_nil }
|
|
129
|
+
end
|
|
82
130
|
end
|
|
83
131
|
end
|
|
84
132
|
|
|
@@ -87,14 +135,20 @@ module Punchblock
|
|
|
87
135
|
describe direction do
|
|
88
136
|
subject { described_class.new :direction => direction }
|
|
89
137
|
|
|
90
|
-
|
|
138
|
+
describe '#direction' do
|
|
139
|
+
subject { super().direction }
|
|
140
|
+
it { should be == direction }
|
|
141
|
+
end
|
|
91
142
|
end
|
|
92
143
|
end
|
|
93
144
|
|
|
94
145
|
describe "no direction" do
|
|
95
146
|
subject { described_class.new }
|
|
96
147
|
|
|
97
|
-
|
|
148
|
+
describe '#direction' do
|
|
149
|
+
subject { super().direction }
|
|
150
|
+
it { should be_nil }
|
|
151
|
+
end
|
|
98
152
|
end
|
|
99
153
|
|
|
100
154
|
describe "blahblahblah" do
|
|
@@ -6,7 +6,7 @@ module Punchblock
|
|
|
6
6
|
module Command
|
|
7
7
|
describe Mute do
|
|
8
8
|
it 'registers itself' do
|
|
9
|
-
RayoNode.class_from_registration(:mute, 'urn:xmpp:rayo:1').
|
|
9
|
+
expect(RayoNode.class_from_registration(:mute, 'urn:xmpp:rayo:1')).to eq(described_class)
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
describe "from a stanza" do
|
|
@@ -20,7 +20,7 @@ module Punchblock
|
|
|
20
20
|
describe "exporting to Rayo" do
|
|
21
21
|
it "should export to XML that can be understood by its parser" do
|
|
22
22
|
new_instance = RayoNode.from_xml subject.to_rayo
|
|
23
|
-
new_instance.
|
|
23
|
+
expect(new_instance).to be_instance_of described_class
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
it "should render to a parent node if supplied" do
|
|
@@ -28,7 +28,7 @@ module Punchblock
|
|
|
28
28
|
parent = Nokogiri::XML::Node.new 'foo', doc
|
|
29
29
|
doc.root = parent
|
|
30
30
|
rayo_doc = subject.to_rayo(parent)
|
|
31
|
-
rayo_doc.
|
|
31
|
+
expect(rayo_doc).to eq(parent)
|
|
32
32
|
end
|
|
33
33
|
end
|
|
34
34
|
end
|
|
@@ -6,21 +6,28 @@ module Punchblock
|
|
|
6
6
|
module Command
|
|
7
7
|
describe Redirect do
|
|
8
8
|
it 'registers itself' do
|
|
9
|
-
RayoNode.class_from_registration(:redirect, 'urn:xmpp:rayo:1').
|
|
9
|
+
expect(RayoNode.class_from_registration(:redirect, 'urn:xmpp:rayo:1')).to eq(described_class)
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
describe "when setting options in initializer" do
|
|
13
13
|
subject { described_class.new to: 'tel:+14045551234', headers: { 'X-skill' => 'agent', 'X-customer-id' => '8877' } }
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
describe '#to' do
|
|
16
|
+
subject { super().to }
|
|
17
|
+
it { should be == 'tel:+14045551234' }
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
describe '#headers' do
|
|
21
|
+
subject { super().headers }
|
|
22
|
+
it { should == { 'X-skill' => 'agent', 'X-customer-id' => '8877' } }
|
|
23
|
+
end
|
|
17
24
|
|
|
18
25
|
describe "exporting to Rayo" do
|
|
19
26
|
it "should export to XML that can be understood by its parser" do
|
|
20
27
|
new_instance = RayoNode.from_xml subject.to_rayo
|
|
21
|
-
new_instance.
|
|
22
|
-
new_instance.to.
|
|
23
|
-
new_instance.headers.
|
|
28
|
+
expect(new_instance).to be_instance_of described_class
|
|
29
|
+
expect(new_instance.to).to eq('tel:+14045551234')
|
|
30
|
+
expect(new_instance.headers).to eq({ 'X-skill' => 'agent', 'X-customer-id' => '8877' })
|
|
24
31
|
end
|
|
25
32
|
|
|
26
33
|
it "should render to a parent node if supplied" do
|
|
@@ -28,14 +35,14 @@ module Punchblock
|
|
|
28
35
|
parent = Nokogiri::XML::Node.new 'foo', doc
|
|
29
36
|
doc.root = parent
|
|
30
37
|
rayo_doc = subject.to_rayo(parent)
|
|
31
|
-
rayo_doc.
|
|
38
|
+
expect(rayo_doc).to eq(parent)
|
|
32
39
|
end
|
|
33
40
|
|
|
34
41
|
context "when attributes are not set" do
|
|
35
42
|
subject { described_class.new }
|
|
36
43
|
|
|
37
44
|
it "should not include them in the XML representation" do
|
|
38
|
-
subject.to_rayo['to'].
|
|
45
|
+
expect(subject.to_rayo['to']).to be_nil
|
|
39
46
|
end
|
|
40
47
|
end
|
|
41
48
|
end
|
|
@@ -57,14 +64,28 @@ module Punchblock
|
|
|
57
64
|
|
|
58
65
|
it { should be_instance_of described_class }
|
|
59
66
|
|
|
60
|
-
|
|
61
|
-
|
|
67
|
+
describe '#to' do
|
|
68
|
+
subject { super().to }
|
|
69
|
+
it { should be == 'tel:+14045551234' }
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
describe '#headers' do
|
|
73
|
+
subject { super().headers }
|
|
74
|
+
it { should == { 'X-skill' => 'agent', 'X-customer-id' => '8877' } }
|
|
75
|
+
end
|
|
62
76
|
|
|
63
77
|
context "with no headers or to provided" do
|
|
64
78
|
let(:stanza) { '<redirect xmlns="urn:xmpp:rayo:1"/>' }
|
|
65
79
|
|
|
66
|
-
|
|
67
|
-
|
|
80
|
+
describe '#to' do
|
|
81
|
+
subject { super().to }
|
|
82
|
+
it { should be_nil }
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
describe '#headers' do
|
|
86
|
+
subject { super().headers }
|
|
87
|
+
it { should == {} }
|
|
88
|
+
end
|
|
68
89
|
end
|
|
69
90
|
end
|
|
70
91
|
end # Redirect
|
|
@@ -6,21 +6,28 @@ module Punchblock
|
|
|
6
6
|
module Command
|
|
7
7
|
describe Reject do
|
|
8
8
|
it 'registers itself' do
|
|
9
|
-
RayoNode.class_from_registration(:reject, 'urn:xmpp:rayo:1').
|
|
9
|
+
expect(RayoNode.class_from_registration(:reject, 'urn:xmpp:rayo:1')).to eq(described_class)
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
describe "when setting options in initializer" do
|
|
13
13
|
subject { described_class.new reason: :busy, headers: { 'X-skill' => 'agent', 'X-customer-id' => '8877' } }
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
describe '#reason' do
|
|
16
|
+
subject { super().reason }
|
|
17
|
+
it { should be == :busy }
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
describe '#headers' do
|
|
21
|
+
subject { super().headers }
|
|
22
|
+
it { should == { 'X-skill' => 'agent', 'X-customer-id' => '8877' } }
|
|
23
|
+
end
|
|
17
24
|
|
|
18
25
|
describe "exporting to Rayo" do
|
|
19
26
|
it "should export to XML that can be understood by its parser" do
|
|
20
27
|
new_instance = RayoNode.from_xml subject.to_rayo
|
|
21
|
-
new_instance.
|
|
22
|
-
new_instance.reason.
|
|
23
|
-
new_instance.headers.
|
|
28
|
+
expect(new_instance).to be_instance_of described_class
|
|
29
|
+
expect(new_instance.reason).to eq(:busy)
|
|
30
|
+
expect(new_instance.headers).to eq({ 'X-skill' => 'agent', 'X-customer-id' => '8877' })
|
|
24
31
|
end
|
|
25
32
|
|
|
26
33
|
it "should render to a parent node if supplied" do
|
|
@@ -28,14 +35,14 @@ module Punchblock
|
|
|
28
35
|
parent = Nokogiri::XML::Node.new 'foo', doc
|
|
29
36
|
doc.root = parent
|
|
30
37
|
rayo_doc = subject.to_rayo(parent)
|
|
31
|
-
rayo_doc.
|
|
38
|
+
expect(rayo_doc).to eq(parent)
|
|
32
39
|
end
|
|
33
40
|
|
|
34
41
|
context "when attributes are not set" do
|
|
35
42
|
subject { described_class.new }
|
|
36
43
|
|
|
37
44
|
it "should not include them in the XML representation" do
|
|
38
|
-
subject.to_rayo.children.count.
|
|
45
|
+
expect(subject.to_rayo.children.count).to eq(0)
|
|
39
46
|
end
|
|
40
47
|
end
|
|
41
48
|
end
|
|
@@ -57,14 +64,28 @@ module Punchblock
|
|
|
57
64
|
|
|
58
65
|
it { should be_instance_of described_class }
|
|
59
66
|
|
|
60
|
-
|
|
61
|
-
|
|
67
|
+
describe '#reason' do
|
|
68
|
+
subject { super().reason }
|
|
69
|
+
it { should be == :busy }
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
describe '#headers' do
|
|
73
|
+
subject { super().headers }
|
|
74
|
+
it { should == { 'X-skill' => 'agent', 'X-customer-id' => '8877' } }
|
|
75
|
+
end
|
|
62
76
|
|
|
63
77
|
context "with no headers or reason provided" do
|
|
64
78
|
let(:stanza) { '<reject xmlns="urn:xmpp:rayo:1"/>' }
|
|
65
79
|
|
|
66
|
-
|
|
67
|
-
|
|
80
|
+
describe '#reason' do
|
|
81
|
+
subject { super().reason }
|
|
82
|
+
it { should be_nil }
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
describe '#headers' do
|
|
86
|
+
subject { super().headers }
|
|
87
|
+
it { should == {} }
|
|
88
|
+
end
|
|
68
89
|
end
|
|
69
90
|
end
|
|
70
91
|
|
|
@@ -73,14 +94,20 @@ module Punchblock
|
|
|
73
94
|
describe reason do
|
|
74
95
|
subject { described_class.new :reason => reason }
|
|
75
96
|
|
|
76
|
-
|
|
97
|
+
describe '#reason' do
|
|
98
|
+
subject { super().reason }
|
|
99
|
+
it { should be == reason }
|
|
100
|
+
end
|
|
77
101
|
end
|
|
78
102
|
end
|
|
79
103
|
|
|
80
104
|
describe "no reason" do
|
|
81
105
|
subject { described_class.new }
|
|
82
106
|
|
|
83
|
-
|
|
107
|
+
describe '#reason' do
|
|
108
|
+
subject { super().reason }
|
|
109
|
+
it { should be_nil }
|
|
110
|
+
end
|
|
84
111
|
end
|
|
85
112
|
|
|
86
113
|
describe "blahblahblah" do
|
|
@@ -6,27 +6,37 @@ module Punchblock
|
|
|
6
6
|
module Command
|
|
7
7
|
describe Unjoin do
|
|
8
8
|
it 'registers itself' do
|
|
9
|
-
RayoNode.class_from_registration(:unjoin, 'urn:xmpp:rayo:1').
|
|
9
|
+
expect(RayoNode.class_from_registration(:unjoin, 'urn:xmpp:rayo:1')).to eq(described_class)
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
describe "when setting options in initializer" do
|
|
13
13
|
subject { Unjoin.new :call_uri => 'abc123', :mixer_name => 'blah' }
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
describe '#call_uri' do
|
|
16
|
+
subject { super().call_uri }
|
|
17
|
+
it { should be == 'abc123' }
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
describe '#mixer_name' do
|
|
21
|
+
subject { super().mixer_name }
|
|
22
|
+
it { should be == 'blah' }
|
|
23
|
+
end
|
|
17
24
|
|
|
18
25
|
context "with old call_id attribute" do
|
|
19
26
|
subject { described_class.new call_id: 'abc123' }
|
|
20
27
|
|
|
21
|
-
|
|
28
|
+
describe '#call_uri' do
|
|
29
|
+
subject { super().call_uri }
|
|
30
|
+
it { should be == 'abc123' }
|
|
31
|
+
end
|
|
22
32
|
end
|
|
23
33
|
|
|
24
34
|
describe "exporting to Rayo" do
|
|
25
35
|
it "should export to XML that can be understood by its parser" do
|
|
26
36
|
new_instance = RayoNode.from_xml subject.to_rayo
|
|
27
|
-
new_instance.
|
|
28
|
-
new_instance.call_uri.
|
|
29
|
-
new_instance.mixer_name.
|
|
37
|
+
expect(new_instance).to be_instance_of described_class
|
|
38
|
+
expect(new_instance.call_uri).to eq('abc123')
|
|
39
|
+
expect(new_instance.mixer_name).to eq('blah')
|
|
30
40
|
end
|
|
31
41
|
|
|
32
42
|
it "should render to a parent node if supplied" do
|
|
@@ -34,15 +44,15 @@ module Punchblock
|
|
|
34
44
|
parent = Nokogiri::XML::Node.new 'foo', doc
|
|
35
45
|
doc.root = parent
|
|
36
46
|
rayo_doc = subject.to_rayo(parent)
|
|
37
|
-
rayo_doc.
|
|
47
|
+
expect(rayo_doc).to eq(parent)
|
|
38
48
|
end
|
|
39
49
|
|
|
40
50
|
context "when attributes are not set" do
|
|
41
51
|
subject { described_class.new call_uri: 'abc123' }
|
|
42
52
|
|
|
43
53
|
it "should not include them in the XML representation" do
|
|
44
|
-
subject.to_rayo['call-uri'].
|
|
45
|
-
subject.to_rayo['mixer-name'].
|
|
54
|
+
expect(subject.to_rayo['call-uri']).to eq('abc123')
|
|
55
|
+
expect(subject.to_rayo['mixer-name']).to be_nil
|
|
46
56
|
end
|
|
47
57
|
end
|
|
48
58
|
end
|
|
@@ -61,8 +71,15 @@ module Punchblock
|
|
|
61
71
|
|
|
62
72
|
it { should be_instance_of described_class }
|
|
63
73
|
|
|
64
|
-
|
|
65
|
-
|
|
74
|
+
describe '#call_uri' do
|
|
75
|
+
subject { super().call_uri }
|
|
76
|
+
it { should be == 'abc123' }
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
describe '#mixer_name' do
|
|
80
|
+
subject { super().mixer_name }
|
|
81
|
+
it { should be == 'blah' }
|
|
82
|
+
end
|
|
66
83
|
end
|
|
67
84
|
end
|
|
68
85
|
end
|