spec/punchblock/component/output_spec.rb in punchblock-1.8.0 vs spec/punchblock/component/output_spec.rb in punchblock-1.8.1
- old
+ new
@@ -68,10 +68,40 @@
its(:repeat_times) { should be == 10 }
its(:max_time) { should be == 30000 }
its(:voice) { should be == 'allison' }
its(:renderer) { should be == 'swift' }
its(:text) { should be == 'Hello world' }
+
+ context "with SSML" do
+ let :stanza do
+ <<-MESSAGE
+<output xmlns='urn:xmpp:rayo:output:1'
+ interrupt-on='speech'
+ start-offset='2000'
+ start-paused='false'
+ repeat-interval='2000'
+ repeat-times='10'
+ max-time='30000'
+ voice='allison'
+ renderer='swift'>
+ <speak version="1.0"
+ xmlns="http://www.w3.org/2001/10/synthesis"
+ xml:lang="en-US">
+ <say-as interpret-as="ordinal">100</say-as>
+ </speak>
+</output>
+ MESSAGE
+ end
+
+ def ssml_doc(mode = :ordinal)
+ RubySpeech::SSML.draw do
+ say_as(:interpret_as => mode) { string '100' }
+ end
+ end
+
+ its(:ssml) { should be == ssml_doc }
+ end
end
describe "for text" do
subject { Output.new :text => 'Once upon a time there was a message...', :voice => 'kate' }
@@ -80,22 +110,22 @@
end
describe "for SSML" do
def ssml_doc(mode = :ordinal)
RubySpeech::SSML.draw do
- say_as(:interpret_as => mode) { 100 }
+ say_as(:interpret_as => mode) { string '100' }
end
end
subject { Output.new :ssml => ssml_doc, :voice => 'kate' }
its(:voice) { should be == 'kate' }
its(:ssml) { should be == ssml_doc }
describe "comparison" do
- let(:output2) { Output.new :ssml => '<speak xmlns="http://www.w3.org/2001/10/synthesis" version="1.0" xml:lang="en-US"><say-as interpret-as="ordinal"/></speak>', :voice => 'kate' }
+ let(:output2) { Output.new :ssml => '<speak xmlns="http://www.w3.org/2001/10/synthesis" version="1.0" xml:lang="en-US"><say-as interpret-as="ordinal">100</say-as></speak>', :voice => 'kate' }
let(:output3) { Output.new :ssml => ssml_doc, :voice => 'kate' }
let(:output4) { Output.new :ssml => ssml_doc(:normal), :voice => 'kate' }
it { should be == output2 }
it { should be == output3 }
@@ -202,10 +232,10 @@
end
describe '#stop_action' do
subject { command.stop_action }
- its(:to_xml) { should be == '<stop xmlns="urn:xmpp:rayo:1"/>' }
+ its(:to_xml) { should be == '<stop xmlns="urn:xmpp:rayo:ext:1"/>' }
its(:component_id) { should be == 'abc123' }
its(:target_call_id) { should be == '123abc' }
end
describe '#stop!' do