spec/punchblock/translator/freeswitch/call_spec.rb in punchblock-1.7.1 vs spec/punchblock/translator/freeswitch/call_spec.rb in punchblock-1.8.0
- old
+ new
@@ -704,9 +704,22 @@
subject.handle_es_event RubyFS::Event.new(nil, :event_name => 'CHANNEL_ANSWER', :scope_variable_punchblock_command_id => 'abc123')
command.response(0.5).should be true
subject.should be_answered
subject.execute_command command
end
+
+ context "when a component has previously been executed" do
+ it "should set the answer command's response correctly" do
+ subject
+ Punchblock.should_receive(:new_uuid).once.and_return 'abc123'
+ subject.wrapped_object.should_receive(:application).once.with('answer', "%[punchblock_command_id=abc123]")
+ subject.should_not be_answered
+ subject.execute_command command
+ subject.handle_es_event RubyFS::Event.new(nil, :event_name => 'CHANNEL_ANSWER', :scope_variable_punchblock_command_id => 'abc123', :scope_variable_punchblock_component_id => 'dj182989j')
+ command.response(0.5).should be true
+ subject.should be_answered
+ end
+ end
end
def expect_hangup_with_reason(reason)
subject.wrapped_object.should_receive(:sendmsg).once.with(:call_command => 'hangup', :hangup_cause => reason)
end