spec/punchblock/translator/asterisk/component/asterisk/agi_command_spec.rb in punchblock-0.8.2 vs spec/punchblock/translator/asterisk/component/asterisk/agi_command_spec.rb in punchblock-0.8.3

- old
+ new

@@ -5,11 +5,17 @@ class Asterisk module Component module Asterisk describe AGICommand do let(:channel) { 'SIP/foo' } - let(:mock_call) { mock 'Call', :channel => channel } + let(:connection) do + mock_connection_with_event_handler do |event| + command.add_event event + end + end + let(:translator) { Punchblock::Translator::Asterisk.new mock('AMI'), connection } + let(:mock_call) { Punchblock::Translator::Asterisk::Call.new channel, translator } let(:component_id) { UUIDTools::UUID.random_create } before { UUIDTools::UUID.stubs :random_create => component_id } let :command do @@ -110,10 +116,10 @@ command.should be_complete complete_event = command.complete_event 0.5 - complete_event.component_id.should == subject.id + complete_event.component_id.should == component_id.to_s complete_event.reason.should == expected_complete_reason end end end