Sha256: c4db719c362219ddbdea439afeb1b9efbdc83413f36dc3e95bce0156371495c0

Contents?: true

Size: 1.36 KB

Versions: 1

Compression:

Stored size: 1.36 KB

Contents

require File.dirname(__FILE__) + '/../test_helper'

class TollFreePhoneNumberTest < Test::Unit::TestCase #:nodoc: all
  context "A toll free phone number" do
    setup do
      Twilio.connect('mysid', 'mytoken')
    end

    should "be retrievable as a list" do
      assert_equal stub_response(:get, :incoming_phone_numbers, :resource => 'IncomingPhoneNumbers/TollFree'),
        Twilio::TollFreePhoneNumber.list
    end
    
    should "be created" do
      assert_equal stub_response(:post, :incoming_phone_number, :resource => 'IncomingPhoneNumbers/TollFree'),
        Twilio::TollFreePhoneNumber.create('http://test.local/call_handler')
    end

    should "be deleted" do
      stub_response(:delete, :incoming_phone_number, { :resource => 'IncomingPhoneNumbers/PNe536dfda7c6184afab78d980cb8cdf43', 
                                              :status   => [ 204, "HTTPNoContent" ] })
      assert Twilio::TollFreePhoneNumber.delete('PNe536dfda7c6184afab78d980cb8cdf43')
    end

    
    context "using deprecated API" do
      setup do
        @connection = Twilio::Connection.new('mysid', 'mytoken')
        @toll_free = Twilio::TollFreePhoneNumber.new(@connection)
      end

      should "be retrievable as a list" do
        assert_equal stub_response(:get, :incoming_phone_numbers, :resource => 'IncomingPhoneNumbers/TollFree'),
          @toll_free.list
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
twilio-2.8.0 test/twilio/toll_free_phone_number_test.rb