spec/adhearsion/call_controller/output_spec.rb in adhearsion-2.4.0 vs spec/adhearsion/call_controller/output_spec.rb in adhearsion-2.5.0
- old
+ new
@@ -336,10 +336,17 @@
describe '#play' do
let(:extra_options) do
{ renderer: :native }
end
+
+ describe "with a nil argument" do
+ it "is a noop" do
+ subject.play nil
+ end
+ end
+
describe "with a single string" do
let(:audio_file) { "/foo/bar.wav" }
let :ssml do
file = audio_file
RubySpeech::SSML.draw { audio :src => file }
@@ -355,19 +362,21 @@
subject.play(audio_file, extra_options).should be true
end
end
describe "with multiple arguments" do
- let(:args) { ["/foo/bar.wav", 1, Time.now] }
+ let(:args) { ["/foo/bar.wav", 1, Time.now, "123#"] }
let :ssml do
file = args[0]
n = args[1].to_s
t = args[2].to_s
+ c = args[3].to_s
RubySpeech::SSML.draw do
audio :src => file
say_as(:interpret_as => 'cardinal') { n }
say_as(:interpret_as => 'time') { t }
+ say_as(:interpret_as => 'characters') { c }
end
end
it 'plays all arguments in one document' do
expect_ssml_output ssml
@@ -396,10 +405,16 @@
it 'plays all arguments in one document' do
expect_ssml_output ssml
subject.play(args).should be true
end
+
+ context "that is empty" do
+ it "is a noop" do
+ subject.play []
+ end
+ end
end
describe "with a number" do
let(:argument) { 123 }
@@ -494,10 +509,17 @@
describe '#play!' do
let(:extra_options) do
{ renderer: :native }
end
+
+ describe "with a nil argument" do
+ it "is a noop" do
+ subject.play! nil
+ end
+ end
+
describe "with a single string" do
let(:audio_file) { "/foo/bar.wav" }
let :ssml do
file = audio_file
RubySpeech::SSML.draw { audio :src => file }
@@ -729,10 +751,16 @@
end
end
end
describe "#say" do
+ describe "with a nil argument" do
+ it "is a no-op" do
+ subject.say nil
+ end
+ end
+
describe "with a RubySpeech document" do
it 'plays the correct SSML' do
ssml = RubySpeech::SSML.draw { string "Hello world" }
expect_ssml_output ssml
subject.say(ssml).should be_a Punchblock::Component::Output
@@ -827,9 +855,15 @@
subject.method(:speak).should be == subject.method(:say)
end
end
describe "#say!" do
+ describe "with a nil argument" do
+ it "is a noop" do
+ subject.say! nil
+ end
+ end
+
describe "with a RubySpeech document" do
it 'plays the correct SSML' do
ssml = RubySpeech::SSML.draw { string "Hello world" }
expect_async_ssml_output ssml
subject.say!(ssml).should be_a Punchblock::Component::Output