spec/punchblock/component/output_spec.rb in punchblock-1.6.1 vs spec/punchblock/component/output_spec.rb in punchblock-1.7.0
- old
+ new
@@ -15,30 +15,33 @@
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 }
+ its(:renderer) { should be nil }
end
describe "when setting options in initializer" do
subject do
Output.new :interrupt_on => :speech,
:start_offset => 2000,
:start_paused => false,
:repeat_interval => 2000,
:repeat_times => 10,
:max_time => 30000,
- :voice => 'allison'
+ :voice => 'allison',
+ :renderer => 'swift'
end
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(:renderer) { should be == 'swift' }
end
describe "from a stanza" do
let :stanza do
<<-MESSAGE
@@ -47,11 +50,12 @@
start-offset='2000'
start-paused='false'
repeat-interval='2000'
repeat-times='10'
max-time='30000'
- voice='allison'>Hello world</output>
+ voice='allison'
+ renderer='swift'>Hello world</output>
MESSAGE
end
subject { RayoNode.import parse_stanza(stanza).root, '9f00061', '1' }
@@ -62,10 +66,11 @@
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(:renderer) { should be == 'swift' }
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' }
@@ -122,12 +127,12 @@
command.request!
command.execute!
end
it "should send its command properly" do
- mock_client.expects(:execute_command).with(command.pause_action, :target_call_id => '123abc', :component_id => 'abc123').returns true
- command.expects :paused!
+ mock_client.should_receive(:execute_command).with(command.pause_action, :target_call_id => '123abc', :component_id => 'abc123').and_return true
+ command.should_receive :paused!
command.pause!
end
end
describe "when the command is not executing" do
@@ -166,12 +171,12 @@
command.execute!
command.paused!
end
it "should send its command properly" do
- mock_client.expects(:execute_command).with(command.resume_action, :target_call_id => '123abc', :component_id => 'abc123').returns true
- command.expects :resumed!
+ mock_client.should_receive(:execute_command).with(command.resume_action, :target_call_id => '123abc', :component_id => 'abc123').and_return true
+ command.should_receive :resumed!
command.resume!
end
end
describe "when the command is not paused" do
@@ -210,11 +215,11 @@
command.request!
command.execute!
end
it "should send its command properly" do
- mock_client.expects(:execute_command).with(command.stop_action, :target_call_id => '123abc', :component_id => 'abc123')
+ mock_client.should_receive(:execute_command).with(command.stop_action, :target_call_id => '123abc', :component_id => 'abc123')
command.stop!
end
end
describe "when the command is not executing" do
@@ -242,14 +247,14 @@
command.execute!
end
it "should send its command properly" do
seek_action = command.seek_action seek_options
- command.stubs(:seek_action).returns seek_action
- mock_client.expects(:execute_command).with(seek_action, :target_call_id => '123abc', :component_id => 'abc123').returns true
- command.expects :seeking!
- command.expects :stopped_seeking!
+ command.stub(:seek_action).and_return seek_action
+ mock_client.should_receive(:execute_command).with(seek_action, :target_call_id => '123abc', :component_id => 'abc123').and_return true
+ command.should_receive :seeking!
+ command.should_receive :stopped_seeking!
command.seek! seek_options
seek_action.request!
seek_action.execute!
end
end
@@ -309,14 +314,14 @@
command.execute!
end
it "should send its command properly" do
speed_up_action = command.speed_up_action
- command.stubs(:speed_up_action).returns speed_up_action
- mock_client.expects(:execute_command).with(speed_up_action, :target_call_id => '123abc', :component_id => 'abc123').returns true
- command.expects :speeding_up!
- command.expects :stopped_speeding!
+ command.stub(:speed_up_action).and_return speed_up_action
+ mock_client.should_receive(:execute_command).with(speed_up_action, :target_call_id => '123abc', :component_id => 'abc123').and_return true
+ command.should_receive :speeding_up!
+ command.should_receive :stopped_speeding!
command.speed_up!
speed_up_action.request!
speed_up_action.execute!
end
end
@@ -367,14 +372,14 @@
command.execute!
end
it "should send its command properly" do
slow_down_action = command.slow_down_action
- command.stubs(:slow_down_action).returns slow_down_action
- mock_client.expects(:execute_command).with(slow_down_action, :target_call_id => '123abc', :component_id => 'abc123').returns true
- command.expects :slowing_down!
- command.expects :stopped_speeding!
+ command.stub(:slow_down_action).and_return slow_down_action
+ mock_client.should_receive(:execute_command).with(slow_down_action, :target_call_id => '123abc', :component_id => 'abc123').and_return true
+ command.should_receive :slowing_down!
+ command.should_receive :stopped_speeding!
command.slow_down!
slow_down_action.request!
slow_down_action.execute!
end
end
@@ -442,14 +447,14 @@
command.execute!
end
it "should send its command properly" do
volume_up_action = command.volume_up_action
- command.stubs(:volume_up_action).returns volume_up_action
- mock_client.expects(:execute_command).with(volume_up_action, :target_call_id => '123abc', :component_id => 'abc123').returns true
- command.expects :voluming_up!
- command.expects :stopped_voluming!
+ command.stub(:volume_up_action).and_return volume_up_action
+ mock_client.should_receive(:execute_command).with(volume_up_action, :target_call_id => '123abc', :component_id => 'abc123').and_return true
+ command.should_receive :voluming_up!
+ command.should_receive :stopped_voluming!
command.volume_up!
volume_up_action.request!
volume_up_action.execute!
end
end
@@ -500,13 +505,13 @@
command.execute!
end
it "should send its command properly" do
volume_down_action = command.volume_down_action
- command.stubs(:volume_down_action).returns volume_down_action
- mock_client.expects(:execute_command).with(volume_down_action, :target_call_id => '123abc', :component_id => 'abc123').returns true
- command.expects :voluming_down!
- command.expects :stopped_voluming!
+ command.stub(:volume_down_action).and_return volume_down_action
+ mock_client.should_receive(:execute_command).with(volume_down_action, :target_call_id => '123abc', :component_id => 'abc123').and_return true
+ command.should_receive :voluming_down!
+ command.should_receive :stopped_voluming!
command.volume_down!
volume_down_action.request!
volume_down_action.execute!
end
end