spec/punchblock/translator/asterisk/call_spec.rb in punchblock-1.9.3 vs spec/punchblock/translator/asterisk/call_spec.rb in punchblock-1.9.4
- old
+ new
@@ -927,18 +927,29 @@
subject.wrapped_object.should_receive(:execute_agi_command).with('ANSWER').and_return code: 200
subject.execute_command command
command.response(0.5).should be true
end
+ it "should be answered" do
+ subject.wrapped_object.should_receive(:execute_agi_command)
+ subject.execute_command command
+ subject.should be_answered
+ end
+
context "when the AMI commannd raises an error" do
let(:message) { 'Some error' }
let(:error) { RubyAMI::Error.new.tap { |e| e.message = message } }
before { subject.wrapped_object.should_receive(:execute_agi_command).and_raise error }
it "should return an error with the message" do
subject.execute_command command
command.response(0.5).should be == ProtocolError.new.setup('error', message, subject.id)
+ end
+
+ it "should not be answered" do
+ subject.execute_command command
+ subject.should_not be_answered
end
context "with message 'No such channel'" do
let(:message) { 'No such channel' }