spec/punchblock/component/output_spec.rb in punchblock-0.7.1 vs spec/punchblock/component/output_spec.rb in punchblock-0.7.2

- old
+ new

@@ -5,10 +5,20 @@ describe Output do it 'registers itself' do RayoNode.class_from_registration(:output, 'urn:xmpp:rayo:output:1').should == Output end + describe 'default values' do + its(:interrupt_on) { should be nil } + its(:start_offset) { should be nil } + its(:start_paused) { should be false } + its(:repeat_interval) { should be nil } + its(:repeat_times) { should be nil } + its(:max_time) { should be nil } + its(:voice) { should be nil } + end + describe "when setting options in initializer" do subject do Output.new :interrupt_on => :speech, :start_offset => 2000, :start_paused => false, @@ -61,21 +71,29 @@ its(:voice) { should == 'kate' } its(:text) { should == 'Once upon a time there was a message...' } end describe "for SSML" do - subject { Output.new :ssml => '<output-as interpret-as="ordinal">100</output-as>', :voice => 'kate' } + def ssml_doc(mode = :ordinal) + RubySpeech::SSML.draw do + say_as(:interpret_as => mode) { 100 } + end + end + subject { Output.new :ssml => ssml_doc, :voice => 'kate' } + its(:voice) { should == 'kate' } - its(:ssml) { should == '<output-as interpret-as="ordinal">100</output-as>' } + its(:ssml) { should == ssml_doc } describe "comparison" do - let(:output2) { Output.new :ssml => '<output-as interpret-as="ordinal">100</output-as>', :voice => 'kate' } - let(:output3) { Output.new :ssml => '<output-as interpret-as="number">100</output-as>', :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"/></speak>', :voice => 'kate' } + let(:output3) { Output.new :ssml => ssml_doc, :voice => 'kate' } + let(:output4) { Output.new :ssml => ssml_doc(:normal), :voice => 'kate' } it { should == output2 } - it { should_not == output3 } + it { should == output3 } + it { should_not == output4 } end end describe "actions" do let(:mock_client) { mock 'Client' }