adhearsion 2.0.1 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +4 -3
- data/CHANGELOG.md +30 -0
- data/README.markdown +1 -0
- data/adhearsion.gemspec +3 -4
- data/bin/ahn +0 -20
- data/features/cli_create.feature +1 -1
- data/features/cli_restart.feature +25 -1
- data/features/cli_start.feature +0 -2
- data/features/plugin_generator.feature +66 -15
- data/features/support/env.rb +0 -13
- data/lib/adhearsion.rb +26 -6
- data/lib/adhearsion/call.rb +42 -7
- data/lib/adhearsion/call_controller.rb +5 -2
- data/lib/adhearsion/call_controller/dial.rb +92 -50
- data/lib/adhearsion/call_controller/input.rb +19 -6
- data/lib/adhearsion/call_controller/menu_dsl/menu.rb +4 -0
- data/lib/adhearsion/call_controller/output.rb +143 -161
- data/lib/adhearsion/call_controller/output/abstract_player.rb +30 -0
- data/lib/adhearsion/call_controller/output/async_player.rb +26 -0
- data/lib/adhearsion/call_controller/output/formatter.rb +81 -0
- data/lib/adhearsion/call_controller/output/player.rb +25 -0
- data/lib/adhearsion/call_controller/record.rb +19 -2
- data/lib/adhearsion/events.rb +3 -0
- data/lib/adhearsion/foundation.rb +12 -6
- data/lib/adhearsion/foundation/exception_handler.rb +8 -6
- data/lib/adhearsion/generators/app/templates/README.md +13 -0
- data/lib/adhearsion/generators/app/templates/config/adhearsion.rb +7 -1
- data/lib/adhearsion/generators/plugin/plugin_generator.rb +1 -0
- data/lib/adhearsion/generators/plugin/templates/plugin-template.gemspec.tt +3 -7
- data/lib/adhearsion/generators/plugin/templates/spec/spec_helper.rb.tt +0 -1
- data/lib/adhearsion/outbound_call.rb +15 -5
- data/lib/adhearsion/punchblock_plugin.rb +13 -2
- data/lib/adhearsion/punchblock_plugin/initializer.rb +13 -12
- data/lib/adhearsion/router.rb +43 -2
- data/lib/adhearsion/router/evented_route.rb +15 -0
- data/lib/adhearsion/router/openended_route.rb +16 -0
- data/lib/adhearsion/router/route.rb +31 -13
- data/lib/adhearsion/router/unaccepting_route.rb +11 -0
- data/lib/adhearsion/version.rb +1 -1
- data/pre-commit +14 -1
- data/spec/adhearsion/call_controller/dial_spec.rb +105 -10
- data/spec/adhearsion/call_controller/input_spec.rb +19 -21
- data/spec/adhearsion/call_controller/output/async_player_spec.rb +67 -0
- data/spec/adhearsion/call_controller/output/formatter_spec.rb +90 -0
- data/spec/adhearsion/call_controller/output/player_spec.rb +65 -0
- data/spec/adhearsion/call_controller/output_spec.rb +436 -190
- data/spec/adhearsion/call_controller/record_spec.rb +49 -6
- data/spec/adhearsion/call_controller_spec.rb +10 -2
- data/spec/adhearsion/call_spec.rb +138 -0
- data/spec/adhearsion/calls_spec.rb +1 -1
- data/spec/adhearsion/outbound_call_spec.rb +48 -8
- data/spec/adhearsion/punchblock_plugin/initializer_spec.rb +34 -23
- data/spec/adhearsion/router/evented_route_spec.rb +34 -0
- data/spec/adhearsion/router/openended_route_spec.rb +61 -0
- data/spec/adhearsion/router/route_spec.rb +26 -4
- data/spec/adhearsion/router/unaccepting_route_spec.rb +72 -0
- data/spec/adhearsion/router_spec.rb +107 -2
- data/spec/adhearsion_spec.rb +19 -0
- data/spec/capture_warnings.rb +28 -21
- data/spec/spec_helper.rb +2 -3
- data/spec/support/call_controller_test_helpers.rb +31 -30
- metadata +32 -29
data/spec/spec_helper.rb
CHANGED
@@ -27,13 +27,12 @@ end
|
|
27
27
|
|
28
28
|
Thread.abort_on_exception = true
|
29
29
|
|
30
|
-
UUID.state_file = false
|
31
|
-
|
32
30
|
Bundler.require(:default, :test) if defined?(Bundler)
|
33
31
|
|
34
32
|
Dir[File.dirname(__FILE__) + "/support/**/*.rb"].each { |f| require f }
|
35
33
|
|
36
34
|
RSpec.configure do |config|
|
35
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
37
36
|
config.mock_framework = :flexmock
|
38
37
|
config.filter_run :focus => true
|
39
38
|
config.run_all_when_everything_filtered = true
|
@@ -69,6 +68,6 @@ module MarmaladeIsBetterThanJam
|
|
69
68
|
end
|
70
69
|
|
71
70
|
def new_uuid
|
72
|
-
|
71
|
+
SecureRandom.uuid
|
73
72
|
end
|
74
73
|
alias :random_call_id :new_uuid
|
@@ -4,48 +4,49 @@ module CallControllerTestHelpers
|
|
4
4
|
include FlexMock::ArgumentTypes
|
5
5
|
|
6
6
|
def self.included(test_case)
|
7
|
-
test_case.let(:call_id)
|
8
|
-
test_case.let(:call)
|
9
|
-
test_case.let(:block)
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
when Class
|
14
|
-
test_case.describes
|
15
|
-
when Module
|
16
|
-
Class.new Adhearsion::CallController
|
17
|
-
end.new call, :doo => :dah, &block
|
18
|
-
end
|
7
|
+
test_case.let(:call_id) { new_uuid }
|
8
|
+
test_case.let(:call) { Adhearsion::Call.new }
|
9
|
+
test_case.let(:block) { nil }
|
10
|
+
test_case.let(:controller) { new_controller test_case.describes }
|
11
|
+
|
12
|
+
test_case.subject { controller }
|
19
13
|
|
20
14
|
test_case.before do
|
21
15
|
flexmock subject
|
16
|
+
flexmock controller
|
22
17
|
flexmock call, :write_command => true, :id => call_id
|
23
18
|
end
|
24
19
|
end
|
25
20
|
|
26
|
-
def
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
end
|
35
|
-
|
36
|
-
def expect_component_execution(component)
|
37
|
-
subject.should_receive(:execute_component_and_await_completion).once.with(component).and_return(component)
|
21
|
+
def new_controller(target = nil)
|
22
|
+
case target
|
23
|
+
when Class
|
24
|
+
raise "Your described class should inherit from Adhearsion::CallController" unless target.ancestors.include?(Adhearsion::CallController)
|
25
|
+
target
|
26
|
+
when Module, nil
|
27
|
+
Class.new Adhearsion::CallController
|
28
|
+
end.new call, :doo => :dah, &block
|
38
29
|
end
|
39
30
|
|
40
|
-
def
|
41
|
-
|
31
|
+
def expect_message_waiting_for_response(message, fail = false)
|
32
|
+
expectation = controller.should_receive(:write_and_await_response).once.with message
|
33
|
+
if fail
|
34
|
+
expectation.and_raise fail
|
35
|
+
else
|
36
|
+
expectation.and_return message
|
37
|
+
end
|
42
38
|
end
|
43
39
|
|
44
|
-
def
|
45
|
-
|
40
|
+
def expect_message_of_type_waiting_for_response(message)
|
41
|
+
controller.should_receive(:write_and_await_response).once.with(message.class).and_return message
|
46
42
|
end
|
47
43
|
|
48
|
-
def
|
49
|
-
|
44
|
+
def expect_component_execution(component, fail = false)
|
45
|
+
expectation = controller.should_receive(:execute_component_and_await_completion).once.with(component)
|
46
|
+
if fail
|
47
|
+
expectation.and_raise fail
|
48
|
+
else
|
49
|
+
expectation.and_return component
|
50
|
+
end
|
50
51
|
end
|
51
52
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: adhearsion
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0
|
4
|
+
version: 2.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2012-
|
15
|
+
date: 2012-08-07 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: activesupport
|
@@ -213,7 +213,7 @@ dependencies:
|
|
213
213
|
requirements:
|
214
214
|
- - ~>
|
215
215
|
- !ruby/object:Gem::Version
|
216
|
-
version: '1.
|
216
|
+
version: '1.4'
|
217
217
|
type: :runtime
|
218
218
|
prerelease: false
|
219
219
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -221,7 +221,7 @@ dependencies:
|
|
221
221
|
requirements:
|
222
222
|
- - ~>
|
223
223
|
- !ruby/object:Gem::Version
|
224
|
-
version: '1.
|
224
|
+
version: '1.4'
|
225
225
|
- !ruby/object:Gem::Dependency
|
226
226
|
name: rake
|
227
227
|
requirement: !ruby/object:Gem::Requirement
|
@@ -270,38 +270,22 @@ dependencies:
|
|
270
270
|
- - ! '>='
|
271
271
|
- !ruby/object:Gem::Version
|
272
272
|
version: '0'
|
273
|
-
- !ruby/object:Gem::Dependency
|
274
|
-
name: uuid
|
275
|
-
requirement: !ruby/object:Gem::Requirement
|
276
|
-
none: false
|
277
|
-
requirements:
|
278
|
-
- - ! '>='
|
279
|
-
- !ruby/object:Gem::Version
|
280
|
-
version: '0'
|
281
|
-
type: :runtime
|
282
|
-
prerelease: false
|
283
|
-
version_requirements: !ruby/object:Gem::Requirement
|
284
|
-
none: false
|
285
|
-
requirements:
|
286
|
-
- - ! '>='
|
287
|
-
- !ruby/object:Gem::Version
|
288
|
-
version: '0'
|
289
273
|
- !ruby/object:Gem::Dependency
|
290
274
|
name: aruba
|
291
275
|
requirement: !ruby/object:Gem::Requirement
|
292
276
|
none: false
|
293
277
|
requirements:
|
294
|
-
- -
|
278
|
+
- - ~>
|
295
279
|
- !ruby/object:Gem::Version
|
296
|
-
version: '0'
|
280
|
+
version: '0.4'
|
297
281
|
type: :development
|
298
282
|
prerelease: false
|
299
283
|
version_requirements: !ruby/object:Gem::Requirement
|
300
284
|
none: false
|
301
285
|
requirements:
|
302
|
-
- -
|
286
|
+
- - ~>
|
303
287
|
- !ruby/object:Gem::Version
|
304
|
-
version: '0'
|
288
|
+
version: '0.4'
|
305
289
|
- !ruby/object:Gem::Dependency
|
306
290
|
name: ci_reporter
|
307
291
|
requirement: !ruby/object:Gem::Requirement
|
@@ -389,7 +373,7 @@ dependencies:
|
|
389
373
|
requirements:
|
390
374
|
- - ~>
|
391
375
|
- !ruby/object:Gem::Version
|
392
|
-
version: 2.
|
376
|
+
version: 2.11.0
|
393
377
|
type: :development
|
394
378
|
prerelease: false
|
395
379
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -397,7 +381,7 @@ dependencies:
|
|
397
381
|
requirements:
|
398
382
|
- - ~>
|
399
383
|
- !ruby/object:Gem::Version
|
400
|
-
version: 2.
|
384
|
+
version: 2.11.0
|
401
385
|
- !ruby/object:Gem::Dependency
|
402
386
|
name: ruby_gntp
|
403
387
|
requirement: !ruby/object:Gem::Requirement
|
@@ -512,6 +496,10 @@ files:
|
|
512
496
|
- lib/adhearsion/call_controller/menu_dsl/range_match_calculator.rb
|
513
497
|
- lib/adhearsion/call_controller/menu_dsl/string_match_calculator.rb
|
514
498
|
- lib/adhearsion/call_controller/output.rb
|
499
|
+
- lib/adhearsion/call_controller/output/abstract_player.rb
|
500
|
+
- lib/adhearsion/call_controller/output/async_player.rb
|
501
|
+
- lib/adhearsion/call_controller/output/formatter.rb
|
502
|
+
- lib/adhearsion/call_controller/output/player.rb
|
515
503
|
- lib/adhearsion/call_controller/record.rb
|
516
504
|
- lib/adhearsion/call_controller/utility.rb
|
517
505
|
- lib/adhearsion/calls.rb
|
@@ -567,7 +555,10 @@ files:
|
|
567
555
|
- lib/adhearsion/punchblock_plugin.rb
|
568
556
|
- lib/adhearsion/punchblock_plugin/initializer.rb
|
569
557
|
- lib/adhearsion/router.rb
|
558
|
+
- lib/adhearsion/router/evented_route.rb
|
559
|
+
- lib/adhearsion/router/openended_route.rb
|
570
560
|
- lib/adhearsion/router/route.rb
|
561
|
+
- lib/adhearsion/router/unaccepting_route.rb
|
571
562
|
- lib/adhearsion/rspec.rb
|
572
563
|
- lib/adhearsion/script_ahn_loader.rb
|
573
564
|
- lib/adhearsion/tasks.rb
|
@@ -587,6 +578,9 @@ files:
|
|
587
578
|
- spec/adhearsion/call_controller/menu_dsl/menu_spec.rb
|
588
579
|
- spec/adhearsion/call_controller/menu_dsl/range_match_calculator_spec.rb
|
589
580
|
- spec/adhearsion/call_controller/menu_dsl/string_match_calculator_spec.rb
|
581
|
+
- spec/adhearsion/call_controller/output/async_player_spec.rb
|
582
|
+
- spec/adhearsion/call_controller/output/formatter_spec.rb
|
583
|
+
- spec/adhearsion/call_controller/output/player_spec.rb
|
590
584
|
- spec/adhearsion/call_controller/output_spec.rb
|
591
585
|
- spec/adhearsion/call_controller/record_spec.rb
|
592
586
|
- spec/adhearsion/call_controller/utility_spec.rb
|
@@ -604,7 +598,10 @@ files:
|
|
604
598
|
- spec/adhearsion/process_spec.rb
|
605
599
|
- spec/adhearsion/punchblock_plugin/initializer_spec.rb
|
606
600
|
- spec/adhearsion/punchblock_plugin_spec.rb
|
601
|
+
- spec/adhearsion/router/evented_route_spec.rb
|
602
|
+
- spec/adhearsion/router/openended_route_spec.rb
|
607
603
|
- spec/adhearsion/router/route_spec.rb
|
604
|
+
- spec/adhearsion/router/unaccepting_route_spec.rb
|
608
605
|
- spec/adhearsion/router_spec.rb
|
609
606
|
- spec/adhearsion_spec.rb
|
610
607
|
- spec/capture_warnings.rb
|
@@ -627,7 +624,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
627
624
|
version: '0'
|
628
625
|
segments:
|
629
626
|
- 0
|
630
|
-
hash:
|
627
|
+
hash: -4451670451160143860
|
631
628
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
632
629
|
none: false
|
633
630
|
requirements:
|
@@ -636,10 +633,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
636
633
|
version: '0'
|
637
634
|
segments:
|
638
635
|
- 0
|
639
|
-
hash:
|
636
|
+
hash: -4451670451160143860
|
640
637
|
requirements: []
|
641
638
|
rubyforge_project:
|
642
|
-
rubygems_version: 1.8.
|
639
|
+
rubygems_version: 1.8.24
|
643
640
|
signing_key:
|
644
641
|
specification_version: 3
|
645
642
|
summary: Adhearsion, open-source telephony development framework
|
@@ -669,6 +666,9 @@ test_files:
|
|
669
666
|
- spec/adhearsion/call_controller/menu_dsl/menu_spec.rb
|
670
667
|
- spec/adhearsion/call_controller/menu_dsl/range_match_calculator_spec.rb
|
671
668
|
- spec/adhearsion/call_controller/menu_dsl/string_match_calculator_spec.rb
|
669
|
+
- spec/adhearsion/call_controller/output/async_player_spec.rb
|
670
|
+
- spec/adhearsion/call_controller/output/formatter_spec.rb
|
671
|
+
- spec/adhearsion/call_controller/output/player_spec.rb
|
672
672
|
- spec/adhearsion/call_controller/output_spec.rb
|
673
673
|
- spec/adhearsion/call_controller/record_spec.rb
|
674
674
|
- spec/adhearsion/call_controller/utility_spec.rb
|
@@ -686,7 +686,10 @@ test_files:
|
|
686
686
|
- spec/adhearsion/process_spec.rb
|
687
687
|
- spec/adhearsion/punchblock_plugin/initializer_spec.rb
|
688
688
|
- spec/adhearsion/punchblock_plugin_spec.rb
|
689
|
+
- spec/adhearsion/router/evented_route_spec.rb
|
690
|
+
- spec/adhearsion/router/openended_route_spec.rb
|
689
691
|
- spec/adhearsion/router/route_spec.rb
|
692
|
+
- spec/adhearsion/router/unaccepting_route_spec.rb
|
690
693
|
- spec/adhearsion/router_spec.rb
|
691
694
|
- spec/adhearsion_spec.rb
|
692
695
|
- spec/capture_warnings.rb
|