spec/punchblock/translator/asterisk/component/output_spec.rb in punchblock-2.0.0 vs spec/punchblock/translator/asterisk/component/output_spec.rb in punchblock-2.0.1
- old
+ new
@@ -430,11 +430,11 @@
def expect_playback_noanswer
mock_call.should_receive(:execute_agi_command).once.with('EXEC Playback', audio_filename + ',noanswer').and_return code: 200
end
- let(:audio_filename) { 'http://foo.com/bar.mp3' }
+ let(:audio_filename) { 'tt-monkeys' }
let :ssml_doc do
RubySpeech::SSML.draw do
audio :src => audio_filename
end
@@ -492,10 +492,30 @@
expect_playback 'tt-monkeys'
subject.execute
end
end
+ context "when the audio filename has an extension" do
+ let(:audio_filename) { 'tt-monkeys.wav' }
+
+ it 'should playback the audio file using Playback' do
+ expect_answered
+ expect_playback 'tt-monkeys'
+ subject.execute
+ end
+
+ context "when there are other dots in the filename" do
+ let(:audio_filename) { 'blue.tt-monkeys.wav' }
+
+ it 'should playback the audio file using Playback' do
+ expect_answered
+ expect_playback 'blue.tt-monkeys'
+ subject.execute
+ end
+ end
+ end
+
context "when we get a RubyAMI Error" do
it "should send an error complete event" do
expect_answered
error = RubyAMI::Error.new.tap { |e| e.message = 'FooBar' }
mock_call.should_receive(:execute_agi_command).and_raise error
@@ -589,11 +609,11 @@
end
end
end
context 'with multiple audio SSML nodes' do
- let(:audio_filename1) { 'http://foo.com/bar.mp3' }
- let(:audio_filename2) { 'http://foo.com/baz.mp3' }
+ let(:audio_filename1) { 'foo' }
+ let(:audio_filename2) { 'bar' }
let :ssml_doc do
RubySpeech::SSML.draw do
audio :src => audio_filename1
audio :src => audio_filename2
end