spec/punchblock/component/output_spec.rb in punchblock-0.9.2 vs spec/punchblock/component/output_spec.rb in punchblock-0.10.0

- old
+ new

@@ -1,12 +1,14 @@ +# encoding: utf-8 + require 'spec_helper' module Punchblock module Component describe Output do it 'registers itself' do - RayoNode.class_from_registration(:output, 'urn:xmpp:rayo:output:1').should == Output + RayoNode.class_from_registration(:output, 'urn:xmpp:rayo:output:1').should be == Output end describe 'default values' do its(:interrupt_on) { should be nil } its(:start_offset) { should be nil } @@ -26,17 +28,17 @@ :repeat_times => 10, :max_time => 30000, :voice => 'allison' end - its(:interrupt_on) { should == :speech } - its(:start_offset) { should == 2000 } - its(:start_paused) { should == false } - its(:repeat_interval) { should == 2000 } - its(:repeat_times) { should == 10 } - its(:max_time) { should == 30000 } - its(:voice) { should == 'allison' } + its(:interrupt_on) { should be == :speech } + its(:start_offset) { should be == 2000 } + its(:start_paused) { should be == false } + its(:repeat_interval) { should be == 2000 } + its(:repeat_times) { should be == 10 } + its(:max_time) { should be == 30000 } + its(:voice) { should be == 'allison' } end describe "from a stanza" do let :stanza do <<-MESSAGE @@ -53,25 +55,25 @@ subject { RayoNode.import parse_stanza(stanza).root, '9f00061', '1' } it { should be_instance_of Output } - its(:interrupt_on) { should == :speech } - its(:start_offset) { should == 2000 } - its(:start_paused) { should == false } - its(:repeat_interval) { should == 2000 } - its(:repeat_times) { should == 10 } - its(:max_time) { should == 30000 } - its(:voice) { should == 'allison' } - its(:text) { should == 'Hello world' } + its(:interrupt_on) { should be == :speech } + its(:start_offset) { should be == 2000 } + its(:start_paused) { should be == false } + its(:repeat_interval) { should be == 2000 } + its(:repeat_times) { should be == 10 } + its(:max_time) { should be == 30000 } + its(:voice) { should be == 'allison' } + its(:text) { should be == 'Hello world' } end describe "for text" do subject { Output.new :text => 'Once upon a time there was a message...', :voice => 'kate' } - its(:voice) { should == 'kate' } - its(:text) { should == 'Once upon a time there was a message...' } + its(:voice) { should be == 'kate' } + its(:text) { should be == 'Once upon a time there was a message...' } end describe "for SSML" do def ssml_doc(mode = :ordinal) RubySpeech::SSML.draw do @@ -79,22 +81,22 @@ end end subject { Output.new :ssml => ssml_doc, :voice => 'kate' } - its(:voice) { should == 'kate' } + its(:voice) { should be == 'kate' } - its(:ssml) { should == ssml_doc } + 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(:output3) { Output.new :ssml => ssml_doc, :voice => 'kate' } let(:output4) { Output.new :ssml => ssml_doc(:normal), :voice => 'kate' } - it { should == output2 } - it { should == output3 } - it { should_not == output4 } + it { should be == output2 } + it { should be == output3 } + it { should_not be == output4 } end end describe "actions" do let(:mock_client) { mock 'Client' } @@ -107,13 +109,13 @@ end describe '#pause_action' do subject { command.pause_action } - its(:to_xml) { should == '<pause xmlns="urn:xmpp:rayo:output:1"/>' } - its(:component_id) { should == 'abc123' } - its(:call_id) { should == '123abc' } + its(:to_xml) { should be == '<pause xmlns="urn:xmpp:rayo:output:1"/>' } + its(:component_id) { should be == 'abc123' } + its(:call_id) { should be == '123abc' } end describe '#pause!' do describe "when the command is executing" do before do @@ -140,23 +142,23 @@ subject.request! subject.execute! subject.paused! end - its(:state_name) { should == :paused } + its(:state_name) { should be == :paused } it "should raise a StateMachine::InvalidTransition when received a second time" do lambda { subject.paused! }.should raise_error(StateMachine::InvalidTransition) end end describe '#resume_action' do subject { command.resume_action } - its(:to_xml) { should == '<resume xmlns="urn:xmpp:rayo:output:1"/>' } - its(:component_id) { should == 'abc123' } - its(:call_id) { should == '123abc' } + its(:to_xml) { should be == '<resume xmlns="urn:xmpp:rayo:output:1"/>' } + its(:component_id) { should be == 'abc123' } + its(:call_id) { should be == '123abc' } end describe '#resume!' do describe "when the command is paused" do before do @@ -185,23 +187,23 @@ subject.execute! subject.paused! subject.resumed! end - its(:state_name) { should == :executing } + its(:state_name) { should be == :executing } it "should raise a StateMachine::InvalidTransition when received a second time" do lambda { subject.resumed! }.should raise_error(StateMachine::InvalidTransition) end end describe '#stop_action' do subject { command.stop_action } - its(:to_xml) { should == '<stop xmlns="urn:xmpp:rayo:1"/>' } - its(:component_id) { should == 'abc123' } - its(:call_id) { should == '123abc' } + its(:to_xml) { should be == '<stop xmlns="urn:xmpp:rayo:1"/>' } + its(:component_id) { should be == 'abc123' } + its(:call_id) { should be == '123abc' } end describe '#stop!' do describe "when the command is executing" do before do @@ -226,13 +228,13 @@ let(:seek_options) { {:direction => :forward, :amount => 1500} } describe '#seek_action' do subject { command.seek_action seek_options } - its(:to_xml) { should == '<seek xmlns="urn:xmpp:rayo:output:1" direction="forward" amount="1500"/>' } - its(:component_id) { should == 'abc123' } - its(:call_id) { should == '123abc' } + its(:to_xml) { should be == '<seek xmlns="urn:xmpp:rayo:output:1" direction="forward" amount="1500"/>' } + its(:component_id) { should be == 'abc123' } + its(:call_id) { should be == '123abc' } end describe '#seek!' do describe "when not seeking" do before do @@ -266,11 +268,11 @@ subject.request! subject.execute! subject.seeking! end - its(:seek_status_name) { should == :seeking } + its(:seek_status_name) { should be == :seeking } it "should raise a StateMachine::InvalidTransition when received a second time" do lambda { subject.seeking! }.should raise_error(StateMachine::InvalidTransition) end end @@ -281,11 +283,11 @@ subject.execute! subject.seeking! subject.stopped_seeking! end - its(:seek_status_name) { should == :not_seeking } + its(:seek_status_name) { should be == :not_seeking } it "should raise a StateMachine::InvalidTransition when received a second time" do lambda { subject.stopped_seeking! }.should raise_error(StateMachine::InvalidTransition) end end @@ -293,13 +295,13 @@ describe "adjusting speed" do describe '#speed_up_action' do subject { command.speed_up_action } - its(:to_xml) { should == '<speed-up xmlns="urn:xmpp:rayo:output:1"/>' } - its(:component_id) { should == 'abc123' } - its(:call_id) { should == '123abc' } + its(:to_xml) { should be == '<speed-up xmlns="urn:xmpp:rayo:output:1"/>' } + its(:component_id) { should be == 'abc123' } + its(:call_id) { should be == '123abc' } end describe '#speed_up!' do describe "when not altering speed" do before do @@ -341,23 +343,23 @@ subject.request! subject.execute! subject.speeding_up! end - its(:speed_status_name) { should == :speeding_up } + its(:speed_status_name) { should be == :speeding_up } it "should raise a StateMachine::InvalidTransition when received a second time" do lambda { subject.speeding_up! }.should raise_error(StateMachine::InvalidTransition) end end describe '#slow_down_action' do subject { command.slow_down_action } - its(:to_xml) { should == '<speed-down xmlns="urn:xmpp:rayo:output:1"/>' } - its(:component_id) { should == 'abc123' } - its(:call_id) { should == '123abc' } + its(:to_xml) { should be == '<speed-down xmlns="urn:xmpp:rayo:output:1"/>' } + its(:component_id) { should be == 'abc123' } + its(:call_id) { should be == '123abc' } end describe '#slow_down!' do describe "when not altering speed" do before do @@ -399,11 +401,11 @@ subject.request! subject.execute! subject.slowing_down! end - its(:speed_status_name) { should == :slowing_down } + its(:speed_status_name) { should be == :slowing_down } it "should raise a StateMachine::InvalidTransition when received a second time" do lambda { subject.slowing_down! }.should raise_error(StateMachine::InvalidTransition) end end @@ -414,11 +416,11 @@ subject.execute! subject.speeding_up! subject.stopped_speeding! end - its(:speed_status_name) { should == :not_speeding } + its(:speed_status_name) { should be == :not_speeding } it "should raise a StateMachine::InvalidTransition when received a second time" do lambda { subject.stopped_speeding! }.should raise_error(StateMachine::InvalidTransition) end end @@ -426,13 +428,13 @@ describe "adjusting volume" do describe '#volume_up_action' do subject { command.volume_up_action } - its(:to_xml) { should == '<volume-up xmlns="urn:xmpp:rayo:output:1"/>' } - its(:component_id) { should == 'abc123' } - its(:call_id) { should == '123abc' } + its(:to_xml) { should be == '<volume-up xmlns="urn:xmpp:rayo:output:1"/>' } + its(:component_id) { should be == 'abc123' } + its(:call_id) { should be == '123abc' } end describe '#volume_up!' do describe "when not altering volume" do before do @@ -474,23 +476,23 @@ subject.request! subject.execute! subject.voluming_up! end - its(:volume_status_name) { should == :voluming_up } + its(:volume_status_name) { should be == :voluming_up } it "should raise a StateMachine::InvalidTransition when received a second time" do lambda { subject.voluming_up! }.should raise_error(StateMachine::InvalidTransition) end end describe '#volume_down_action' do subject { command.volume_down_action } - its(:to_xml) { should == '<volume-down xmlns="urn:xmpp:rayo:output:1"/>' } - its(:component_id) { should == 'abc123' } - its(:call_id) { should == '123abc' } + its(:to_xml) { should be == '<volume-down xmlns="urn:xmpp:rayo:output:1"/>' } + its(:component_id) { should be == 'abc123' } + its(:call_id) { should be == '123abc' } end describe '#volume_down!' do describe "when not altering volume" do before do @@ -532,11 +534,11 @@ subject.request! subject.execute! subject.voluming_down! end - its(:volume_status_name) { should == :voluming_down } + its(:volume_status_name) { should be == :voluming_down } it "should raise a StateMachine::InvalidTransition when received a second time" do lambda { subject.voluming_down! }.should raise_error(StateMachine::InvalidTransition) end end @@ -547,11 +549,11 @@ subject.execute! subject.voluming_up! subject.stopped_voluming! end - its(:volume_status_name) { should == :not_voluming } + its(:volume_status_name) { should be == :not_voluming } it "should raise a StateMachine::InvalidTransition when received a second time" do lambda { subject.stopped_voluming! }.should raise_error(StateMachine::InvalidTransition) end end @@ -570,9 +572,9 @@ subject { RayoNode.import(parse_stanza(stanza).root).reason } it { should be_instance_of Output::Complete::Success } - its(:name) { should == :success } + its(:name) { should be == :success } end end end # Punchblock