spec/punchblock/component/tropo/say_spec.rb in punchblock-0.4.3 vs spec/punchblock/component/tropo/say_spec.rb in punchblock-0.5.0

- old
+ new

@@ -23,16 +23,17 @@ subject.child.to_s.should == '<say-as interpret-as="ordinal">100</say-as>' end end describe "actions" do + let(:mock_client) { mock 'Client' } let(:command) { Say.new :text => 'Once upon a time there was a message...', :voice => 'kate' } before do command.component_id = 'abc123' command.call_id = '123abc' - command.connection = Connection.new :username => '123', :password => '123' + command.client = mock_client end describe '#pause_action' do subject { command.pause_action } @@ -47,11 +48,11 @@ command.request! command.execute! end it "should send its command properly" do - Connection.any_instance.expects(:write).with('123abc', command.pause_action, 'abc123').returns true + mock_client.expects(:execute_command).with(command.pause_action, :call_id => '123abc', :component_id => 'abc123').returns true command.expects :paused! command.pause! end end @@ -91,11 +92,11 @@ command.execute! command.paused! end it "should send its command properly" do - Connection.any_instance.expects(:write).with('123abc', command.resume_action, 'abc123').returns true + mock_client.expects(:execute_command).with(command.resume_action, :call_id => '123abc', :component_id => 'abc123').returns true command.expects :resumed! command.resume! end end @@ -135,10 +136,10 @@ command.request! command.execute! end it "should send its command properly" do - Connection.any_instance.expects(:write).with('123abc', command.stop_action, 'abc123') + mock_client.expects(:execute_command).with(command.stop_action, :call_id => '123abc', :component_id => 'abc123') command.stop! end end describe "when the command is not executing" do