adhearsion-asr 1.3.0 → 1.4.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/CHANGELOG.md +4 -0
- data/adhearsion_asr.gemspec +1 -1
- data/lib/adhearsion-asr/plugin.rb +1 -0
- data/lib/adhearsion-asr/prompt_builder.rb +3 -3
- data/lib/adhearsion-asr/version.rb +1 -1
- data/spec/adhearsion-asr/controller_methods_spec.rb +78 -62
- data/spec/spec_helper.rb +4 -4
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 10b4c378b6fbc550f7d36f9ab5e0ea0cecd4ec60
|
4
|
+
data.tar.gz: 1ce64eaa9708e12f12125eb61dffe121f3d30e07
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7114b62fe3145dc74cd001c9b7f16e00cc8b8c2415644560393b85f230520c3a78396af63e91cbecf0177fc23ecc486b2c1294efe90be4dbd1db3b6797d39788
|
7
|
+
data.tar.gz: 46787dc004e45f9f089359d8d9db690cb6b53a8ab18edae9dca5438cfcdca5c5a601c52a1ff601ba1490b7f120be2a94c4020f4d5bcf3ed57ede1ec8b2546706
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# [develop](https://github.com/adhearsion/adhearsion-asr)
|
2
2
|
|
3
|
+
# [v1.4.0](https://github.com/adhearsion/adhearsion-asr/compare/1.3.0...1.4.0) - [2015-06-15](https://rubygems.org/gems/adhearsion-asr/versions/1.4.0)
|
4
|
+
* Feature: Added support for passing a custom render_document to #ask
|
5
|
+
* Feature: Permit specifying a separate inter-digit timeout with a more useful default
|
6
|
+
|
3
7
|
# [v1.3.0](https://github.com/adhearsion/adhearsion-asr/compare/1.2.0...1.3.0) - [2015-04-24](https://rubygems.org/gems/adhearsion-asr/versions/1.3.0)
|
4
8
|
* Bugfix: Correctly handle nil prompts
|
5
9
|
* Feature: Allow disabling timeouts with -1
|
data/adhearsion_asr.gemspec
CHANGED
@@ -24,7 +24,7 @@ Gem::Specification.new do |s|
|
|
24
24
|
s.add_runtime_dependency %q<ruby_speech>, ["~> 2.1"]
|
25
25
|
|
26
26
|
s.add_development_dependency %q<bundler>, ["~> 1.0"]
|
27
|
-
s.add_development_dependency %q<rspec>, ["~>
|
27
|
+
s.add_development_dependency %q<rspec>, ["~> 3.0"]
|
28
28
|
s.add_development_dependency %q<rake>, [">= 0"]
|
29
29
|
s.add_development_dependency %q<guard-rspec>
|
30
30
|
s.add_development_dependency %q<rb-fsevent>, ['~> 0.9']
|
@@ -4,6 +4,7 @@ module AdhearsionASR
|
|
4
4
|
auto_include true, transform: Proc.new { |v| v == 'true' }, desc: "Enable or disable auto inclusion of overridden Adhearsion Core methods in all call controllers."
|
5
5
|
min_confidence 0.5, desc: 'The default minimum confidence level used for all recognizer invocations.', transform: Proc.new { |v| v.to_f }
|
6
6
|
timeout 5, desc: 'The default timeout (in seconds) used for all recognizer invocations.', transform: Proc.new { |v| v.to_i }
|
7
|
+
inter_digit_timeout 2, desc: 'The timeout used between DTMF digits and to terminate partial invocations', transform: Proc.new { |v| v.to_i }
|
7
8
|
recognizer nil, desc: 'The default recognizer used for all input. Set nil to use platform default.'
|
8
9
|
input_language 'en-US', desc: 'The default language set on generated grammars. Set nil to use platform default.'
|
9
10
|
end
|
@@ -6,7 +6,7 @@ module AdhearsionASR
|
|
6
6
|
input_options = {
|
7
7
|
mode: options[:mode] || :dtmf,
|
8
8
|
initial_timeout: timeout(options[:timeout] || Plugin.config.timeout),
|
9
|
-
inter_digit_timeout: timeout(options[:
|
9
|
+
inter_digit_timeout: timeout(options[:inter_digit_timeout] || Plugin.config.inter_digit_timeout),
|
10
10
|
max_silence: timeout(options[:timeout] || Plugin.config.timeout),
|
11
11
|
min_confidence: Plugin.config.min_confidence,
|
12
12
|
grammars: grammars,
|
@@ -15,9 +15,9 @@ module AdhearsionASR
|
|
15
15
|
terminator: options[:terminator]
|
16
16
|
}.merge(options[:input_options] || {})
|
17
17
|
|
18
|
-
@prompt = if output_document
|
18
|
+
@prompt = if output_document || options[:render_document]
|
19
19
|
output_options = {
|
20
|
-
render_document: {value: output_document},
|
20
|
+
render_document: options[:render_document] || {value: output_document},
|
21
21
|
renderer: Adhearsion.config.platform.media.default_renderer,
|
22
22
|
voice: Adhearsion.config.platform.media.default_voice
|
23
23
|
}.merge(options[:output_options] || {})
|
@@ -18,7 +18,7 @@ module AdhearsionASR
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def expect_component_execution(component, fail = false)
|
21
|
-
expectation = controller.
|
21
|
+
expectation = expect(controller).to receive(:execute_component_and_await_completion).ordered.with(component)
|
22
22
|
if fail
|
23
23
|
expectation.and_raise fail
|
24
24
|
else
|
@@ -61,7 +61,7 @@ module AdhearsionASR
|
|
61
61
|
{
|
62
62
|
mode: :dtmf,
|
63
63
|
initial_timeout: 5000,
|
64
|
-
inter_digit_timeout:
|
64
|
+
inter_digit_timeout: 2000,
|
65
65
|
max_silence: 5000,
|
66
66
|
min_confidence: 0.5,
|
67
67
|
recognizer: nil,
|
@@ -78,7 +78,7 @@ module AdhearsionASR
|
|
78
78
|
|
79
79
|
let(:reason) { Punchblock::Component::Input::Complete::NoMatch.new }
|
80
80
|
|
81
|
-
before { Punchblock::Component::Prompt.
|
81
|
+
before { allow_any_instance_of(Punchblock::Component::Prompt).to receive(:complete_event).and_return(double(reason: reason)) }
|
82
82
|
|
83
83
|
describe "#ask" do
|
84
84
|
let :digit_limit_grammar do
|
@@ -121,15 +121,30 @@ module AdhearsionASR
|
|
121
121
|
|
122
122
|
context "with no prompts" do
|
123
123
|
it "executes an Input component with the correct grammar" do
|
124
|
-
Punchblock::Component::Input.
|
124
|
+
allow_any_instance_of(Punchblock::Component::Input).to receive(:complete_event).and_return(double(reason: reason))
|
125
125
|
expect_component_execution Punchblock::Component::Input.new(expected_input_options)
|
126
126
|
subject.ask limit: 5
|
127
127
|
end
|
128
128
|
end
|
129
129
|
|
130
|
+
context "with no prompts, but with a render_document option" do
|
131
|
+
let :expected_output_options do
|
132
|
+
{
|
133
|
+
render_document: {url: 'http://foo.com/bar'},
|
134
|
+
renderer: nil
|
135
|
+
}
|
136
|
+
end
|
137
|
+
|
138
|
+
it "executes an Input component with the correct grammar" do
|
139
|
+
allow_any_instance_of(Punchblock::Component::Input).to receive(:complete_event).and_return(double(reason: reason))
|
140
|
+
expect_component_execution expected_prompt
|
141
|
+
subject.ask limit: 5, render_document: {url: 'http://foo.com/bar'}
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
130
145
|
context "with only nil prompts" do
|
131
146
|
it "executes an Input component with the correct grammar" do
|
132
|
-
Punchblock::Component::Input.
|
147
|
+
allow_any_instance_of(Punchblock::Component::Input).to receive(:complete_event).and_return(double(reason: reason))
|
133
148
|
expect_component_execution Punchblock::Component::Input.new(expected_input_options)
|
134
149
|
subject.ask nil, limit: 5
|
135
150
|
end
|
@@ -138,9 +153,9 @@ module AdhearsionASR
|
|
138
153
|
context "with a block passed" do
|
139
154
|
it "executes but logs a warning about the block validator" do
|
140
155
|
expect_component_execution expected_prompt
|
141
|
-
call.logger.
|
156
|
+
expect(call.logger).to receive(:warn).with(/validator/)
|
142
157
|
target = double
|
143
|
-
target.
|
158
|
+
expect(target).to receive(:foo).never
|
144
159
|
|
145
160
|
subject.ask prompts, limit: 5 do |buffer|
|
146
161
|
target.foo
|
@@ -306,7 +321,7 @@ module AdhearsionASR
|
|
306
321
|
|
307
322
|
before do
|
308
323
|
expected_input_options.merge! initial_timeout: 10000,
|
309
|
-
inter_digit_timeout:
|
324
|
+
inter_digit_timeout: 2000,
|
310
325
|
max_silence: 10000
|
311
326
|
end
|
312
327
|
|
@@ -329,7 +344,7 @@ module AdhearsionASR
|
|
329
344
|
it "executes a Prompt with correct timeout (initial, inter-digit & max-silence)" do
|
330
345
|
expect_component_execution expected_prompt
|
331
346
|
|
332
|
-
subject.ask prompts, limit: 5, timeout: -1
|
347
|
+
subject.ask prompts, limit: 5, timeout: -1, inter_digit_timeout: -1
|
333
348
|
end
|
334
349
|
end
|
335
350
|
|
@@ -338,7 +353,7 @@ module AdhearsionASR
|
|
338
353
|
|
339
354
|
before do
|
340
355
|
expected_input_options.merge! initial_timeout: 10000,
|
341
|
-
inter_digit_timeout:
|
356
|
+
inter_digit_timeout: 2000,
|
342
357
|
max_silence: 10000
|
343
358
|
end
|
344
359
|
|
@@ -492,13 +507,13 @@ module AdhearsionASR
|
|
492
507
|
let(:reason) { Punchblock::Component::Input::Complete::Match.new nlsml: nlsml }
|
493
508
|
|
494
509
|
it "returns :match status and the utterance" do
|
495
|
-
result.status.
|
496
|
-
result.
|
497
|
-
result.mode.
|
498
|
-
result.confidence.
|
499
|
-
result.utterance.
|
500
|
-
result.interpretation.
|
501
|
-
result.nlsml.
|
510
|
+
expect(result.status).to be :match
|
511
|
+
expect(result).to be_match
|
512
|
+
expect(result.mode).to be :dtmf
|
513
|
+
expect(result.confidence).to eq(1)
|
514
|
+
expect(result.utterance).to eq('123')
|
515
|
+
expect(result.interpretation).to eq('Foo')
|
516
|
+
expect(result.nlsml).to eq(nlsml)
|
502
517
|
end
|
503
518
|
|
504
519
|
context "with speech input" do
|
@@ -506,7 +521,7 @@ module AdhearsionASR
|
|
506
521
|
let(:utterance) { 'Hello world' }
|
507
522
|
|
508
523
|
it "should not alter the utterance" do
|
509
|
-
result.utterance.
|
524
|
+
expect(result.utterance).to eq('Hello world')
|
510
525
|
end
|
511
526
|
end
|
512
527
|
|
@@ -515,7 +530,7 @@ module AdhearsionASR
|
|
515
530
|
let(:utterance) { 'dtmf-3' }
|
516
531
|
|
517
532
|
it "removes dtmf- previxes" do
|
518
|
-
result.utterance.
|
533
|
+
expect(result.utterance).to eq('3')
|
519
534
|
end
|
520
535
|
end
|
521
536
|
|
@@ -523,7 +538,7 @@ module AdhearsionASR
|
|
523
538
|
let(:utterance) { "dtmf-star" }
|
524
539
|
|
525
540
|
it "interprets as *" do
|
526
|
-
result.utterance.
|
541
|
+
expect(result.utterance).to eq('*')
|
527
542
|
end
|
528
543
|
end
|
529
544
|
|
@@ -531,7 +546,7 @@ module AdhearsionASR
|
|
531
546
|
let(:utterance) { '*' }
|
532
547
|
|
533
548
|
it "interprets as *" do
|
534
|
-
result.utterance.
|
549
|
+
expect(result.utterance).to eq('*')
|
535
550
|
end
|
536
551
|
end
|
537
552
|
|
@@ -539,7 +554,7 @@ module AdhearsionASR
|
|
539
554
|
let(:utterance) { 'dtmf-pound' }
|
540
555
|
|
541
556
|
it "interprets pound as #" do
|
542
|
-
result.utterance.
|
557
|
+
expect(result.utterance).to eq('#')
|
543
558
|
end
|
544
559
|
end
|
545
560
|
|
@@ -547,7 +562,7 @@ module AdhearsionASR
|
|
547
562
|
let(:utterance) { '#' }
|
548
563
|
|
549
564
|
it "interprets # as #" do
|
550
|
-
result.utterance.
|
565
|
+
expect(result.utterance).to eq('#')
|
551
566
|
end
|
552
567
|
end
|
553
568
|
|
@@ -555,7 +570,7 @@ module AdhearsionASR
|
|
555
570
|
let(:utterance) { '1' }
|
556
571
|
|
557
572
|
it "correctly interprets the digits" do
|
558
|
-
result.utterance.
|
573
|
+
expect(result.utterance).to eq('1')
|
559
574
|
end
|
560
575
|
end
|
561
576
|
|
@@ -563,7 +578,7 @@ module AdhearsionASR
|
|
563
578
|
let(:utterance) { nil }
|
564
579
|
|
565
580
|
it "is nil when utterance is nil" do
|
566
|
-
result.utterance.
|
581
|
+
expect(result.utterance).to eq(nil)
|
567
582
|
end
|
568
583
|
end
|
569
584
|
|
@@ -571,7 +586,7 @@ module AdhearsionASR
|
|
571
586
|
let(:utterance) { 'foo' }
|
572
587
|
|
573
588
|
it "returns the utterance" do
|
574
|
-
result.response.
|
589
|
+
expect(result.response).to eq('foo')
|
575
590
|
end
|
576
591
|
end
|
577
592
|
end
|
@@ -580,7 +595,7 @@ module AdhearsionASR
|
|
580
595
|
let(:utterance) { '1 dtmf-5 dtmf-star # 2' }
|
581
596
|
|
582
597
|
it "returns the digits without space separation" do
|
583
|
-
result.utterance.
|
598
|
+
expect(result.utterance).to eq('15*#2')
|
584
599
|
end
|
585
600
|
end
|
586
601
|
end
|
@@ -589,9 +604,9 @@ module AdhearsionASR
|
|
589
604
|
let(:reason) { Punchblock::Component::Input::Complete::NoMatch.new }
|
590
605
|
|
591
606
|
it "returns :nomatch status and a nil utterance" do
|
592
|
-
result.status.
|
593
|
-
result.
|
594
|
-
result.utterance.
|
607
|
+
expect(result.status).to eql(:nomatch)
|
608
|
+
expect(result).not_to be_match
|
609
|
+
expect(result.utterance).to be_nil
|
595
610
|
end
|
596
611
|
end
|
597
612
|
|
@@ -599,9 +614,9 @@ module AdhearsionASR
|
|
599
614
|
let(:reason) { Punchblock::Component::Input::Complete::NoInput.new }
|
600
615
|
|
601
616
|
it "returns :noinput status and a nil utterance" do
|
602
|
-
result.status.
|
603
|
-
result.
|
604
|
-
result.utterance.
|
617
|
+
expect(result.status).to eql(:noinput)
|
618
|
+
expect(result).not_to be_match
|
619
|
+
expect(result.utterance).to be_nil
|
605
620
|
end
|
606
621
|
end
|
607
622
|
|
@@ -609,9 +624,9 @@ module AdhearsionASR
|
|
609
624
|
let(:reason) { Punchblock::Event::Complete::Hangup.new }
|
610
625
|
|
611
626
|
it "returns :hangup status and a nil utterance" do
|
612
|
-
result.status.
|
613
|
-
result.
|
614
|
-
result.utterance.
|
627
|
+
expect(result.status).to eql(:hangup)
|
628
|
+
expect(result).not_to be_match
|
629
|
+
expect(result.utterance).to be_nil
|
615
630
|
end
|
616
631
|
end
|
617
632
|
|
@@ -619,9 +634,9 @@ module AdhearsionASR
|
|
619
634
|
let(:reason) { Punchblock::Event::Complete::Stop.new }
|
620
635
|
|
621
636
|
it "returns :stop status and a nil utterance" do
|
622
|
-
result.status.
|
623
|
-
result.
|
624
|
-
result.utterance.
|
637
|
+
expect(result.status).to eql(:stop)
|
638
|
+
expect(result).not_to be_match
|
639
|
+
expect(result.utterance).to be_nil
|
625
640
|
end
|
626
641
|
end
|
627
642
|
|
@@ -676,7 +691,7 @@ module AdhearsionASR
|
|
676
691
|
doo = foo
|
677
692
|
match(1) { do_nothing }
|
678
693
|
end
|
679
|
-
doo.
|
694
|
+
expect(doo).to eq(:bar)
|
680
695
|
end
|
681
696
|
|
682
697
|
context "with nil prompts" do
|
@@ -692,7 +707,7 @@ module AdhearsionASR
|
|
692
707
|
|
693
708
|
context "with no prompts" do
|
694
709
|
it "executes an Input component with the correct grammar" do
|
695
|
-
Punchblock::Component::Input.
|
710
|
+
allow_any_instance_of(Punchblock::Component::Input).to receive(:complete_event).and_return(double(reason: reason))
|
696
711
|
expect_component_execution Punchblock::Component::Input.new(expected_input_options)
|
697
712
|
subject.menu do
|
698
713
|
match(1) {}
|
@@ -702,7 +717,7 @@ module AdhearsionASR
|
|
702
717
|
|
703
718
|
context "with only nil prompts" do
|
704
719
|
it "executes an Input component with the correct grammar" do
|
705
|
-
Punchblock::Component::Input.
|
720
|
+
allow_any_instance_of(Punchblock::Component::Input).to receive(:complete_event).and_return(double(reason: reason))
|
706
721
|
expect_component_execution Punchblock::Component::Input.new(expected_input_options)
|
707
722
|
subject.menu nil do
|
708
723
|
match(1) {}
|
@@ -732,7 +747,7 @@ module AdhearsionASR
|
|
732
747
|
it "executes a Prompt with correct timeout (initial, inter-digit & max-silence)" do
|
733
748
|
expect_component_execution expected_prompt
|
734
749
|
|
735
|
-
subject.menu prompts, timeout: 10 do
|
750
|
+
subject.menu prompts, timeout: 10, inter_digit_timeout: 10 do
|
736
751
|
match(1) {}
|
737
752
|
end
|
738
753
|
end
|
@@ -746,6 +761,7 @@ module AdhearsionASR
|
|
746
761
|
end
|
747
762
|
|
748
763
|
temp_config_value :timeout, 10
|
764
|
+
temp_config_value :inter_digit_timeout, 10
|
749
765
|
|
750
766
|
it "executes a Prompt with correct timeout (initial, inter-digit & max-silence)" do
|
751
767
|
expect_component_execution expected_prompt
|
@@ -922,8 +938,8 @@ module AdhearsionASR
|
|
922
938
|
context "when input doesn't match any of the specified matches" do
|
923
939
|
it "runs the invalid and failure handlers" do
|
924
940
|
expect_component_execution expected_prompt
|
925
|
-
|
926
|
-
|
941
|
+
expect(self).to receive(:do_something_on_invalid).once.ordered
|
942
|
+
expect(self).to receive(:do_something_on_failure).once.ordered
|
927
943
|
|
928
944
|
subject.menu prompts do
|
929
945
|
match(1) {}
|
@@ -949,12 +965,12 @@ module AdhearsionASR
|
|
949
965
|
some_controller_class = Class.new Adhearsion::CallController
|
950
966
|
|
951
967
|
expect_component_execution(expected_prompt).twice
|
952
|
-
|
953
|
-
|
954
|
-
|
968
|
+
expect(self).to receive(:do_something_on_invalid).once.ordered
|
969
|
+
expect(self).to receive(:invoke).once.with(some_controller_class, extension: '1').ordered
|
970
|
+
expect(self).to receive(:do_something_on_failure).never
|
955
971
|
|
956
972
|
invocation_count = 0
|
957
|
-
Punchblock::Component::Prompt.
|
973
|
+
allow_any_instance_of(Punchblock::Component::Prompt).to receive(:complete_event) do
|
958
974
|
invocation_count += 1
|
959
975
|
case invocation_count
|
960
976
|
when 1 then double(reason: reason)
|
@@ -978,8 +994,8 @@ module AdhearsionASR
|
|
978
994
|
|
979
995
|
it "runs the timeout and failure handlers" do
|
980
996
|
expect_component_execution expected_prompt
|
981
|
-
|
982
|
-
|
997
|
+
expect(self).to receive(:do_something_on_timeout).once.ordered
|
998
|
+
expect(self).to receive(:do_something_on_failure).once.ordered
|
983
999
|
|
984
1000
|
subject.menu prompts do
|
985
1001
|
match(1) {}
|
@@ -1005,12 +1021,12 @@ module AdhearsionASR
|
|
1005
1021
|
some_controller_class = Class.new Adhearsion::CallController
|
1006
1022
|
|
1007
1023
|
expect_component_execution(expected_prompt).twice
|
1008
|
-
|
1009
|
-
|
1010
|
-
|
1024
|
+
expect(self).to receive(:do_something_on_timeout).once.ordered
|
1025
|
+
expect(self).to receive(:invoke).once.with(some_controller_class, extension: '1').ordered
|
1026
|
+
expect(self).to receive(:do_something_on_failure).never
|
1011
1027
|
|
1012
1028
|
invocation_count = 0
|
1013
|
-
Punchblock::Component::Prompt.
|
1029
|
+
allow_any_instance_of(Punchblock::Component::Prompt).to receive(:complete_event) do
|
1014
1030
|
invocation_count += 1
|
1015
1031
|
case invocation_count
|
1016
1032
|
when 1 then double(reason: reason)
|
@@ -1069,7 +1085,7 @@ module AdhearsionASR
|
|
1069
1085
|
some_controller_class = Class.new Adhearsion::CallController
|
1070
1086
|
|
1071
1087
|
expect_component_execution expected_prompt
|
1072
|
-
|
1088
|
+
expect(self).to receive(:invoke).once.with(some_controller_class, extension: '3')
|
1073
1089
|
|
1074
1090
|
subject.menu prompts do
|
1075
1091
|
match(2) {}
|
@@ -1082,7 +1098,7 @@ module AdhearsionASR
|
|
1082
1098
|
context "which specifies a block to be run" do
|
1083
1099
|
it "invokes the block, passing in the input that matched" do
|
1084
1100
|
expect_component_execution expected_prompt
|
1085
|
-
|
1101
|
+
expect(self).to receive(:do_something_on_match).once.with('3')
|
1086
1102
|
|
1087
1103
|
subject.menu prompts do
|
1088
1104
|
match(2) {}
|
@@ -1121,7 +1137,7 @@ module AdhearsionASR
|
|
1121
1137
|
|
1122
1138
|
it "invokes the match payload" do
|
1123
1139
|
expect_component_execution expected_prompt
|
1124
|
-
|
1140
|
+
expect(self).to receive(:do_something_on_match).once.with('3')
|
1125
1141
|
|
1126
1142
|
subject.menu prompts do
|
1127
1143
|
match(0) {}
|
@@ -1160,7 +1176,7 @@ module AdhearsionASR
|
|
1160
1176
|
|
1161
1177
|
it "invokes the match payload" do
|
1162
1178
|
expect_component_execution expected_prompt
|
1163
|
-
|
1179
|
+
expect(self).to receive(:do_something_on_match).once.with('3')
|
1164
1180
|
|
1165
1181
|
subject.menu prompts do
|
1166
1182
|
match(0) {}
|
@@ -1199,7 +1215,7 @@ module AdhearsionASR
|
|
1199
1215
|
|
1200
1216
|
it "invokes the match payload" do
|
1201
1217
|
expect_component_execution expected_prompt
|
1202
|
-
|
1218
|
+
expect(self).to receive(:do_something_on_match).once.with('3')
|
1203
1219
|
|
1204
1220
|
subject.menu prompts do
|
1205
1221
|
match(0) {}
|
@@ -1244,8 +1260,8 @@ module AdhearsionASR
|
|
1244
1260
|
|
1245
1261
|
it "executes the first successful match" do
|
1246
1262
|
expect_component_execution expected_prompt
|
1247
|
-
|
1248
|
-
|
1263
|
+
expect(self).to receive(:do_something_on_match).once.with('1')
|
1264
|
+
expect(self).to receive(:do_otherthing_on_match).never
|
1249
1265
|
|
1250
1266
|
subject.menu prompts do
|
1251
1267
|
match(1) { |v| do_something_on_match v }
|
data/spec/spec_helper.rb
CHANGED
@@ -2,19 +2,19 @@ require 'adhearsion'
|
|
2
2
|
require 'adhearsion-asr'
|
3
3
|
|
4
4
|
RSpec.configure do |config|
|
5
|
-
config.
|
5
|
+
config.color = true
|
6
6
|
config.tty = true
|
7
7
|
|
8
8
|
config.mock_with :rspec
|
9
9
|
config.filter_run :focus => true
|
10
10
|
config.run_all_when_everything_filtered = true
|
11
11
|
|
12
|
-
config.
|
12
|
+
config.backtrace_exclusion_patterns = [/rspec/]
|
13
13
|
|
14
14
|
config.before do
|
15
15
|
@current_datetime = DateTime.now
|
16
|
-
DateTime.
|
16
|
+
allow(DateTime).to receive(:now).and_return(@current_datetime)
|
17
17
|
|
18
|
-
Punchblock.
|
18
|
+
allow(Punchblock).to receive(:new_request_id).and_return('foo')
|
19
19
|
end
|
20
20
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: adhearsion-asr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Langfeld
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: adhearsion
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '3.0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
82
|
+
version: '3.0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rake
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|