Sha256: c1ccb67f6feee3cf611291c2eb663cbbe95566469d95651c3d7a0e0625293c44

Contents?: true

Size: 1.33 KB

Versions: 1

Compression:

Stored size: 1.33 KB

Contents

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

class LocalPhoneNumberTest < Test::Unit::TestCase #:nodoc: all
  context "A local 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/Local'), 
        Twilio::LocalPhoneNumber.list
    end
    
    should "be created" do
      assert_equal stub_response(:post, :incoming_phone_number, :resource => 'IncomingPhoneNumbers/Local'), 
        Twilio::LocalPhoneNumber.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::LocalPhoneNumber.delete('PNe536dfda7c6184afab78d980cb8cdf43')
    end
    
    context "using deprecated API" do
      setup do
        @connection = Twilio::Connection.new('mysid', 'mytoken')
        @local = Twilio::LocalPhoneNumber.new(@connection)
      end

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

Version data entries

1 entries across 1 versions & 1 rubygems

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