adhearsion 2.5.4 → 2.6.0
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/CHANGELOG.md +15 -0
- data/README.markdown +2 -1
- data/Rakefile +1 -6
- data/adhearsion.gemspec +4 -3
- data/features/cli_daemon.feature +2 -4
- data/features/cli_restart.feature +14 -5
- data/features/cli_start.feature +0 -2
- data/features/cli_stop.feature +15 -6
- data/lib/adhearsion.rb +21 -23
- data/lib/adhearsion/call.rb +49 -5
- data/lib/adhearsion/call_controller.rb +29 -11
- data/lib/adhearsion/call_controller/dial.rb +21 -9
- data/lib/adhearsion/call_controller/menu_dsl.rb +12 -12
- data/lib/adhearsion/call_controller/menu_dsl/array_match_calculator.rb +1 -1
- data/lib/adhearsion/call_controller/menu_dsl/fixnum_match_calculator.rb +1 -0
- data/lib/adhearsion/call_controller/menu_dsl/string_match_calculator.rb +1 -1
- data/lib/adhearsion/call_controller/output.rb +36 -7
- data/lib/adhearsion/call_controller/output/abstract_player.rb +4 -0
- data/lib/adhearsion/call_controller/record.rb +1 -0
- data/lib/adhearsion/cli_commands/ahn_command.rb +7 -4
- data/lib/adhearsion/cli_commands/plugin_command.rb +2 -0
- data/lib/adhearsion/generators.rb +2 -4
- data/lib/adhearsion/generators/app/templates/simon_game_spec.rb +20 -20
- data/lib/adhearsion/initializer.rb +2 -2
- data/lib/adhearsion/plugin.rb +6 -6
- data/lib/adhearsion/punchblock_plugin.rb +3 -4
- data/lib/adhearsion/punchblock_plugin/initializer.rb +2 -1
- data/lib/adhearsion/router.rb +7 -7
- data/lib/adhearsion/router/route.rb +10 -4
- data/lib/adhearsion/rspec.rb +2 -0
- data/lib/adhearsion/version.rb +1 -1
- data/spec/adhearsion/call_controller/dial_spec.rb +589 -557
- data/spec/adhearsion/call_controller/input_spec.rb +91 -91
- data/spec/adhearsion/call_controller/menu_dsl/array_match_calculator_spec.rb +29 -29
- data/spec/adhearsion/call_controller/menu_dsl/calculated_match_collection_spec.rb +6 -6
- data/spec/adhearsion/call_controller/menu_dsl/calculated_match_spec.rb +19 -19
- data/spec/adhearsion/call_controller/menu_dsl/fixnum_match_calculator_spec.rb +6 -6
- data/spec/adhearsion/call_controller/menu_dsl/match_calculator_spec.rb +1 -1
- data/spec/adhearsion/call_controller/menu_dsl/menu_builder_spec.rb +21 -17
- data/spec/adhearsion/call_controller/menu_dsl/menu_spec.rb +96 -83
- data/spec/adhearsion/call_controller/menu_dsl/range_match_calculator_spec.rb +5 -5
- data/spec/adhearsion/call_controller/menu_dsl/string_match_calculator_spec.rb +9 -9
- data/spec/adhearsion/call_controller/output/async_player_spec.rb +14 -4
- data/spec/adhearsion/call_controller/output/formatter_spec.rb +14 -14
- data/spec/adhearsion/call_controller/output/player_spec.rb +15 -5
- data/spec/adhearsion/call_controller/output_spec.rb +126 -78
- data/spec/adhearsion/call_controller/record_spec.rb +38 -26
- data/spec/adhearsion/call_controller/utility_spec.rb +11 -11
- data/spec/adhearsion/call_controller_spec.rb +176 -136
- data/spec/adhearsion/call_spec.rb +443 -218
- data/spec/adhearsion/calls_spec.rb +33 -33
- data/spec/adhearsion/configuration_spec.rb +61 -61
- data/spec/adhearsion/console_spec.rb +29 -29
- data/spec/adhearsion/events_spec.rb +14 -14
- data/spec/adhearsion/generators_spec.rb +1 -1
- data/spec/adhearsion/initializer_spec.rb +42 -42
- data/spec/adhearsion/logging_spec.rb +33 -33
- data/spec/adhearsion/outbound_call_spec.rb +69 -55
- data/spec/adhearsion/plugin_spec.rb +53 -44
- data/spec/adhearsion/process_spec.rb +21 -21
- data/spec/adhearsion/punchblock_plugin/initializer_spec.rb +68 -52
- data/spec/adhearsion/punchblock_plugin_spec.rb +6 -6
- data/spec/adhearsion/router/evented_route_spec.rb +2 -2
- data/spec/adhearsion/router/openended_route_spec.rb +9 -9
- data/spec/adhearsion/router/route_spec.rb +61 -31
- data/spec/adhearsion/router/unaccepting_route_spec.rb +13 -13
- data/spec/adhearsion/router_spec.rb +47 -33
- data/spec/adhearsion/statistics/dump_spec.rb +6 -6
- data/spec/adhearsion/statistics_spec.rb +9 -9
- data/spec/adhearsion_spec.rb +23 -20
- data/spec/spec_helper.rb +3 -6
- data/spec/support/call_controller_test_helpers.rb +7 -7
- data/spec/support/initializer_stubs.rb +1 -1
- data/spec/support/punchblock_mocks.rb +1 -1
- metadata +22 -10
- data/features/support/utils.rb +0 -9
@@ -11,7 +11,7 @@ module Adhearsion
|
|
11
11
|
|
12
12
|
before { subject.extend described_class }
|
13
13
|
|
14
|
-
it {
|
14
|
+
it { is_expected.to be_evented }
|
15
15
|
|
16
16
|
describe "dispatching a call" do
|
17
17
|
let(:call) { Call.new }
|
@@ -24,7 +24,7 @@ module Adhearsion
|
|
24
24
|
end
|
25
25
|
|
26
26
|
it "should yield the call to the block" do
|
27
|
-
call.
|
27
|
+
expect(call).to receive(:foo).once
|
28
28
|
route.dispatch call
|
29
29
|
end
|
30
30
|
end
|
@@ -11,34 +11,34 @@ module Adhearsion
|
|
11
11
|
|
12
12
|
before { subject.extend described_class }
|
13
13
|
|
14
|
-
it {
|
14
|
+
it { is_expected.to be_openended }
|
15
15
|
|
16
16
|
describe "dispatching a call" do
|
17
17
|
let(:call) { Call.new }
|
18
18
|
|
19
19
|
let(:latch) { CountDownLatch.new 1 }
|
20
20
|
|
21
|
-
before { call.wrapped_object.
|
21
|
+
before { allow(call.wrapped_object).to receive :write_and_await_response }
|
22
22
|
|
23
23
|
context "via a call controller" do
|
24
24
|
let(:controller) { CallController }
|
25
25
|
subject(:route) { Route.new 'foobar', controller }
|
26
26
|
|
27
27
|
it "should accept the call" do
|
28
|
-
call.
|
28
|
+
expect(call).to receive(:accept).once
|
29
29
|
route.dispatch call, lambda { latch.countdown! }
|
30
|
-
latch.wait(2).
|
30
|
+
expect(latch.wait(2)).to be true
|
31
31
|
end
|
32
32
|
|
33
33
|
it "should instruct the call to use an instance of the controller" do
|
34
|
-
call.
|
34
|
+
expect(call).to receive(:execute_controller).once.with kind_of(controller), kind_of(Proc)
|
35
35
|
route.dispatch call
|
36
36
|
end
|
37
37
|
|
38
38
|
it "should not hangup the call after all controllers have executed" do
|
39
|
-
call.
|
39
|
+
expect(call).to receive(:hangup).never
|
40
40
|
route.dispatch call, lambda { latch.countdown! }
|
41
|
-
latch.wait(2).
|
41
|
+
expect(latch.wait(2)).to be true
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
@@ -50,8 +50,8 @@ module Adhearsion
|
|
50
50
|
end
|
51
51
|
|
52
52
|
it "should instruct the call to use a CallController with the correct block" do
|
53
|
-
call.
|
54
|
-
controller.block.call.
|
53
|
+
expect(call).to receive(:execute_controller).once.with(kind_of(CallController), kind_of(Proc)) do |controller|
|
54
|
+
expect(controller.block.call).to eq(:foobar)
|
55
55
|
end
|
56
56
|
route.dispatch call
|
57
57
|
end
|
@@ -16,25 +16,47 @@ module Adhearsion
|
|
16
16
|
|
17
17
|
subject { Route.new name }
|
18
18
|
|
19
|
-
it {
|
20
|
-
it {
|
19
|
+
it { is_expected.not_to be_evented }
|
20
|
+
it { is_expected.to be_accepting }
|
21
21
|
|
22
22
|
describe "with a class target and guards" do
|
23
23
|
let(:target) { CallController }
|
24
24
|
|
25
25
|
subject { Route.new name, target, *guards }
|
26
26
|
|
27
|
-
|
28
|
-
|
29
|
-
|
27
|
+
describe '#name' do
|
28
|
+
subject { super().name }
|
29
|
+
it { is_expected.to eq(name) }
|
30
|
+
end
|
31
|
+
|
32
|
+
describe '#target' do
|
33
|
+
subject { super().target }
|
34
|
+
it { is_expected.to eq(target) }
|
35
|
+
end
|
36
|
+
|
37
|
+
describe '#guards' do
|
38
|
+
subject { super().guards }
|
39
|
+
it { is_expected.to eq(guards) }
|
40
|
+
end
|
30
41
|
end
|
31
42
|
|
32
43
|
describe "with a block target and guards" do
|
33
44
|
subject { Route.new(name, *guards) { :foo } }
|
34
45
|
|
35
|
-
|
36
|
-
|
37
|
-
|
46
|
+
describe '#name' do
|
47
|
+
subject { super().name }
|
48
|
+
it { is_expected.to eq(name) }
|
49
|
+
end
|
50
|
+
|
51
|
+
describe '#target' do
|
52
|
+
subject { super().target }
|
53
|
+
it { is_expected.to be_a Proc }
|
54
|
+
end
|
55
|
+
|
56
|
+
describe '#guards' do
|
57
|
+
subject { super().guards }
|
58
|
+
it { is_expected.to eq(guards) }
|
59
|
+
end
|
38
60
|
end
|
39
61
|
end
|
40
62
|
|
@@ -42,11 +64,11 @@ module Adhearsion
|
|
42
64
|
subject { Route.new 'foobar', CallController, *guards }
|
43
65
|
|
44
66
|
def should_match_the_call
|
45
|
-
subject.match?(call).
|
67
|
+
expect(subject.match?(call)).to be true
|
46
68
|
end
|
47
69
|
|
48
70
|
def should_not_match_the_call
|
49
|
-
subject.match?(call).
|
71
|
+
expect(subject.match?(call)).to be false
|
50
72
|
end
|
51
73
|
|
52
74
|
describe "matching calls from fred to paul" do
|
@@ -109,34 +131,42 @@ module Adhearsion
|
|
109
131
|
|
110
132
|
let(:latch) { CountDownLatch.new 1 }
|
111
133
|
|
112
|
-
before { call.wrapped_object.
|
134
|
+
before { allow(call.wrapped_object).to receive :write_and_await_response }
|
113
135
|
|
114
136
|
context "via a call controller" do
|
115
137
|
let(:controller) { CallController }
|
116
138
|
let(:route) { Route.new 'foobar', controller }
|
117
139
|
|
118
140
|
it "should immediately fire the :call_routed event giving the call and route" do
|
119
|
-
Adhearsion::Events.
|
120
|
-
call.
|
141
|
+
expect(Adhearsion::Events).to receive(:trigger_immediately).once.with(:call_routed, call: call, route: route)
|
142
|
+
expect(call).to receive(:hangup).once
|
121
143
|
route.dispatch call, lambda { latch.countdown! }
|
122
|
-
latch.wait(2).
|
144
|
+
expect(latch.wait(2)).to be true
|
123
145
|
end
|
124
146
|
|
125
147
|
it "should accept the call" do
|
126
|
-
call.
|
148
|
+
expect(call).to receive(:accept).once
|
127
149
|
route.dispatch call, lambda { latch.countdown! }
|
128
|
-
latch.wait(2).
|
150
|
+
expect(latch.wait(2)).to be true
|
129
151
|
end
|
130
152
|
|
131
153
|
it "should instruct the call to use an instance of the controller" do
|
132
|
-
call.
|
154
|
+
expect(call).to receive(:execute_controller).once.with kind_of(controller), kind_of(Proc)
|
133
155
|
route.dispatch call
|
134
156
|
end
|
135
157
|
|
136
158
|
it "should hangup the call after all controllers have executed" do
|
137
|
-
call.
|
159
|
+
expect(call).to receive(:hangup).once
|
138
160
|
route.dispatch call, lambda { latch.countdown! }
|
139
|
-
latch.wait(2).
|
161
|
+
expect(latch.wait(2)).to be true
|
162
|
+
end
|
163
|
+
|
164
|
+
context "when the call has already ended before routing can begin" do
|
165
|
+
before { Celluloid::Actor.kill call }
|
166
|
+
|
167
|
+
it "should fall through cleanly" do
|
168
|
+
expect { route.dispatch call }.not_to raise_error
|
169
|
+
end
|
140
170
|
end
|
141
171
|
|
142
172
|
context "when the call has already ended before routing can begin" do
|
@@ -162,7 +192,7 @@ module Adhearsion
|
|
162
192
|
|
163
193
|
it "gives the next call fresh metadata" do
|
164
194
|
expected_controller = controller.new call, nil
|
165
|
-
call.
|
195
|
+
expect(call).to receive(:execute_controller).once.with expected_controller, kind_of(Proc)
|
166
196
|
route.dispatch call
|
167
197
|
end
|
168
198
|
end
|
@@ -171,20 +201,20 @@ module Adhearsion
|
|
171
201
|
before { call.auto_hangup = false }
|
172
202
|
|
173
203
|
it "should not hangup the call after controller execution" do
|
174
|
-
call.
|
204
|
+
expect(call).to receive(:hangup).never
|
175
205
|
route.dispatch call, lambda { latch.countdown! }
|
176
|
-
latch.wait(2).
|
206
|
+
expect(latch.wait(2)).to be true
|
177
207
|
end
|
178
208
|
end
|
179
209
|
|
180
210
|
context "if hangup raises a Call::Hangup" do
|
181
|
-
before { call.
|
211
|
+
before { expect(call).to receive(:hangup).once.and_raise Call::Hangup }
|
182
212
|
|
183
213
|
it "should not raise an exception" do
|
184
|
-
|
214
|
+
expect do
|
185
215
|
route.dispatch call, lambda { latch.countdown! }
|
186
|
-
latch.wait(2).
|
187
|
-
end.
|
216
|
+
expect(latch.wait(2)).to be true
|
217
|
+
end.not_to raise_error
|
188
218
|
end
|
189
219
|
end
|
190
220
|
|
@@ -198,10 +228,10 @@ module Adhearsion
|
|
198
228
|
end
|
199
229
|
|
200
230
|
it "should not raise an exception" do
|
201
|
-
|
231
|
+
expect do
|
202
232
|
route.dispatch call, lambda { latch.countdown! }
|
203
|
-
latch.wait(2).
|
204
|
-
end.
|
233
|
+
expect(latch.wait(2)).to be true
|
234
|
+
end.not_to raise_error
|
205
235
|
end
|
206
236
|
end
|
207
237
|
end
|
@@ -214,8 +244,8 @@ module Adhearsion
|
|
214
244
|
end
|
215
245
|
|
216
246
|
it "should instruct the call to use a CallController with the correct block" do
|
217
|
-
call.
|
218
|
-
controller.block.call.
|
247
|
+
expect(call).to receive(:execute_controller).once.with(kind_of(CallController), kind_of(Proc)) do |controller|
|
248
|
+
expect(controller.block.call).to eq(:foobar)
|
219
249
|
end
|
220
250
|
route.dispatch call
|
221
251
|
end
|
@@ -11,44 +11,44 @@ module Adhearsion
|
|
11
11
|
|
12
12
|
before { subject.extend described_class }
|
13
13
|
|
14
|
-
it {
|
14
|
+
it { is_expected.not_to be_accepting }
|
15
15
|
|
16
16
|
describe "dispatching a call" do
|
17
17
|
let(:call) { Call.new }
|
18
18
|
|
19
19
|
let(:latch) { CountDownLatch.new 1 }
|
20
20
|
|
21
|
-
before { call.wrapped_object.
|
21
|
+
before { allow(call.wrapped_object).to receive :write_and_await_response }
|
22
22
|
|
23
23
|
context "via a call controller" do
|
24
24
|
let(:controller) { CallController }
|
25
25
|
subject(:route) { Route.new 'foobar', controller }
|
26
26
|
|
27
27
|
it "should not accept the call" do
|
28
|
-
call.
|
28
|
+
expect(call).to receive(:accept).never
|
29
29
|
route.dispatch call, lambda { latch.countdown! }
|
30
|
-
latch.wait(2).
|
30
|
+
expect(latch.wait(2)).to be true
|
31
31
|
end
|
32
32
|
|
33
33
|
it "should instruct the call to use an instance of the controller" do
|
34
|
-
call.
|
34
|
+
expect(call).to receive(:execute_controller).once.with kind_of(controller), kind_of(Proc)
|
35
35
|
route.dispatch call
|
36
36
|
end
|
37
37
|
|
38
38
|
it "should hangup the call after all controllers have executed" do
|
39
|
-
call.
|
39
|
+
expect(call).to receive(:hangup).once
|
40
40
|
route.dispatch call, lambda { latch.countdown! }
|
41
|
-
latch.wait(2).
|
41
|
+
expect(latch.wait(2)).to be true
|
42
42
|
end
|
43
43
|
|
44
44
|
context "if hangup raises a Call::Hangup" do
|
45
|
-
before { call.
|
45
|
+
before { expect(call).to receive(:hangup).once.and_raise Call::Hangup }
|
46
46
|
|
47
47
|
it "should not raise an exception" do
|
48
|
-
|
48
|
+
expect do
|
49
49
|
route.dispatch call, lambda { latch.countdown! }
|
50
|
-
latch.wait(2).
|
51
|
-
end.
|
50
|
+
expect(latch.wait(2)).to be true
|
51
|
+
end.not_to raise_error
|
52
52
|
end
|
53
53
|
end
|
54
54
|
end
|
@@ -61,8 +61,8 @@ module Adhearsion
|
|
61
61
|
end
|
62
62
|
|
63
63
|
it "should instruct the call to use a CallController with the correct block" do
|
64
|
-
call.
|
65
|
-
controller.block.call.
|
64
|
+
expect(call).to receive(:execute_controller).once.with(kind_of(CallController), kind_of(Proc)) do |controller|
|
65
|
+
expect(controller.block.call).to eq(:foobar)
|
66
66
|
end
|
67
67
|
route.dispatch call
|
68
68
|
end
|
@@ -10,14 +10,14 @@ module Adhearsion
|
|
10
10
|
subject { Router.new {} }
|
11
11
|
|
12
12
|
let(:call) { double 'Adhearsion::Call' }
|
13
|
-
before { call.
|
13
|
+
before { allow(call).to receive_messages id: 'abc123' }
|
14
14
|
|
15
15
|
it "should make the router available to the block" do
|
16
16
|
foo = nil
|
17
17
|
Router.new do
|
18
18
|
foo = self
|
19
19
|
end
|
20
|
-
foo.
|
20
|
+
expect(foo).to be_a Router
|
21
21
|
end
|
22
22
|
|
23
23
|
describe "defining routes in the block" do
|
@@ -35,26 +35,28 @@ module Adhearsion
|
|
35
35
|
|
36
36
|
subject { router.routes }
|
37
37
|
|
38
|
-
it
|
38
|
+
it 'has 3 elements' do
|
39
|
+
expect(subject.size).to eq(3)
|
40
|
+
end
|
39
41
|
|
40
42
|
it "should contain Routes" do
|
41
43
|
subject.each do |route|
|
42
|
-
route.
|
44
|
+
expect(route).to be_a Router::Route
|
43
45
|
end
|
44
46
|
end
|
45
47
|
|
46
48
|
it "should build up the routes with the correct data" do
|
47
|
-
subject[0].name.
|
48
|
-
subject[0].guards.
|
49
|
-
subject[0].target.
|
49
|
+
expect(subject[0].name).to eq('calls from fred')
|
50
|
+
expect(subject[0].guards).to eq([{:from => 'fred'}])
|
51
|
+
expect(subject[0].target).to eq(FooBarController)
|
50
52
|
|
51
|
-
subject[1].name.
|
52
|
-
subject[1].guards.
|
53
|
-
subject[1].target.
|
53
|
+
expect(subject[1].name).to eq('calls from paul')
|
54
|
+
expect(subject[1].guards).to eq([{:from => 'paul'}])
|
55
|
+
expect(subject[1].target).to be_a Proc
|
54
56
|
|
55
|
-
subject[2].name.
|
56
|
-
subject[2].guards.
|
57
|
-
subject[2].target.
|
57
|
+
expect(subject[2].name).to eq('catchall')
|
58
|
+
expect(subject[2].guards).to eq([])
|
59
|
+
expect(subject[2].target).to be_a Proc
|
58
60
|
end
|
59
61
|
|
60
62
|
context "as evented" do
|
@@ -70,8 +72,8 @@ module Adhearsion
|
|
70
72
|
end
|
71
73
|
|
72
74
|
it "should create a route which is evented" do
|
73
|
-
subject[0].
|
74
|
-
subject[1].
|
75
|
+
expect(subject[0]).not_to be_evented
|
76
|
+
expect(subject[1]).to be_evented
|
75
77
|
end
|
76
78
|
end
|
77
79
|
|
@@ -88,8 +90,8 @@ module Adhearsion
|
|
88
90
|
end
|
89
91
|
|
90
92
|
it "should create a route with is unaccepting" do
|
91
|
-
subject[0].
|
92
|
-
subject[1].
|
93
|
+
expect(subject[0]).to be_accepting
|
94
|
+
expect(subject[1]).not_to be_accepting
|
93
95
|
end
|
94
96
|
end
|
95
97
|
|
@@ -106,8 +108,8 @@ module Adhearsion
|
|
106
108
|
end
|
107
109
|
|
108
110
|
it "should create a route which is openended" do
|
109
|
-
subject[0].
|
110
|
-
subject[1].
|
111
|
+
expect(subject[0]).not_to be_openended
|
112
|
+
expect(subject[1]).to be_openended
|
111
113
|
end
|
112
114
|
end
|
113
115
|
|
@@ -126,10 +128,10 @@ module Adhearsion
|
|
126
128
|
end
|
127
129
|
|
128
130
|
it "should create a route which is evented and unaccepting" do
|
129
|
-
subject[0].
|
130
|
-
subject[0].
|
131
|
-
subject[1].
|
132
|
-
subject[1].
|
131
|
+
expect(subject[0]).to be_accepting
|
132
|
+
expect(subject[0]).not_to be_evented
|
133
|
+
expect(subject[1]).to be_evented
|
134
|
+
expect(subject[1]).not_to be_accepting
|
133
135
|
end
|
134
136
|
end
|
135
137
|
end
|
@@ -153,18 +155,30 @@ module Adhearsion
|
|
153
155
|
subject { router.match call }
|
154
156
|
|
155
157
|
context 'with a call from fred' do
|
156
|
-
before { call.
|
157
|
-
|
158
|
+
before { allow(call).to receive_messages :from => 'fred' }
|
159
|
+
|
160
|
+
describe '#name' do
|
161
|
+
subject { super().name }
|
162
|
+
it { is_expected.to eq('calls from fred') }
|
163
|
+
end
|
158
164
|
end
|
159
165
|
|
160
166
|
context 'with a call from paul' do
|
161
|
-
before { call.
|
162
|
-
|
167
|
+
before { allow(call).to receive_messages :from => 'paul' }
|
168
|
+
|
169
|
+
describe '#name' do
|
170
|
+
subject { super().name }
|
171
|
+
it { is_expected.to eq('calls from paul') }
|
172
|
+
end
|
163
173
|
end
|
164
174
|
|
165
175
|
context 'with a call from frank' do
|
166
|
-
before { call.
|
167
|
-
|
176
|
+
before { allow(call).to receive_messages :from => 'frank' }
|
177
|
+
|
178
|
+
describe '#name' do
|
179
|
+
subject { super().name }
|
180
|
+
it { is_expected.to eq('catchall') }
|
181
|
+
end
|
168
182
|
end
|
169
183
|
end
|
170
184
|
|
@@ -178,7 +192,7 @@ module Adhearsion
|
|
178
192
|
let(:route) { subject.routes.first }
|
179
193
|
|
180
194
|
it "should dispatch via the route" do
|
181
|
-
route.
|
195
|
+
expect(route).to receive(:dispatch).once.with call
|
182
196
|
subject.handle call
|
183
197
|
end
|
184
198
|
|
@@ -188,7 +202,7 @@ module Adhearsion
|
|
188
202
|
end
|
189
203
|
|
190
204
|
it "should return a dispatcher which rejects the call as an error" do
|
191
|
-
call.
|
205
|
+
expect(call).to receive(:reject).once.with(:error)
|
192
206
|
subject.handle call
|
193
207
|
end
|
194
208
|
end
|
@@ -200,10 +214,10 @@ module Adhearsion
|
|
200
214
|
end
|
201
215
|
end
|
202
216
|
|
203
|
-
before { call.
|
217
|
+
before { allow(call).to receive_messages to: 'bar' }
|
204
218
|
|
205
219
|
it "should return a dispatcher which rejects the call as an error" do
|
206
|
-
call.
|
220
|
+
expect(call).to receive(:reject).once.with(:error)
|
207
221
|
subject.handle call
|
208
222
|
end
|
209
223
|
end
|