Sha256: 25f70ddc71f61ccf0c0fea7135d27419cad26f3d24f2a4643f28b5e3c8868a96

Contents?: true

Size: 958 Bytes

Versions: 2

Compression:

Stored size: 958 Bytes

Contents

require 'spec_helper'

describe 'When the caller hangs up' do
  before do
    @call = create :call

    post "/zestphone/providers/twilio/calls/#{@call.id}/leave_queue",
      { QueueResult: "hangup" }
  end

  it 'sets the call as terminated' do
    @call.reload
    @call.should be_terminated
  end
end

describe 'When Twilio fails to enqueue the caller call' do
  before do
    @call = create :call
    Rails.logger.should_receive(:error)

    post "/zestphone/providers/twilio/calls/#{@call.id}/leave_queue",
      { QueueResult: "error" }
  end

  it 'sets the call as terminated and logs the error' do
    @call.reload
    @call.should be_terminated
  end
end

describe 'When the caller is taken from the queue' do
  before do
    @call = create :call

    post "/zestphone/providers/twilio/calls/#{@call.id}/leave_queue",
      { QueueResult: "redirected" }
  end

  it 'does not change the call state' do
    @call.should be_not_initiated
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
telephony-1.0.4 spec/requests/providers/twilio/calls/leave_queue_spec.rb
telephony-1.0.3 spec/requests/providers/twilio/calls/leave_queue_spec.rb