Sha256: a84f96126cb7ea5d42ccbe18bb66a583c0d92f2cc970bd2c0e6c775040e797c2

Contents?: true

Size: 1.36 KB

Versions: 4

Compression:

Stored size: 1.36 KB

Contents

require 'spec_helper'

describe "Incoming Phone Number" do
  before(:all) do
    Twilio.connect('mysid', 'mytoken')
    @incoming_sid = 'PNe536dfda7c6184afab78d980cb8cdf43'
  end
  
  it "gets a specific phone number" do
    response, url = stub_get(:incoming_phone_number, "IncomingPhoneNumbers/#{@incoming_sid}")
    
    Twilio::IncomingPhoneNumber.get(@incoming_sid).should == response
    WebMock.should have_requested(:get, url)
  end
  
  it "gets a list of phone numbers" do
    response, url = stub_get(:incoming_phone_numbers, 'IncomingPhoneNumbers')
    
    Twilio::IncomingPhoneNumber.list.should == response
    WebMock.should have_requested(:get, url)
  end
  
  context "creating" do
    it "is created" do
      response, url = stub_post(:incoming_phone_number, 'IncomingPhoneNumbers')

      Twilio::IncomingPhoneNumber.create(:PhoneNumber => '8055551212').should == response
      WebMock.should have_requested(:post, url)
    end
    
    it "raises an exception if PhoneNumber or AreaCode are not set" do
      expect { Twilio::IncomingPhoneNumber.create(:FriendlyName => 'Booyah') }.to raise_exception
    end
  end
  
  it "is deleted" do
    response, url = stub_delete(:incoming_phone_number, "IncomingPhoneNumbers/#{@incoming_sid}")
    
    Twilio::IncomingPhoneNumber.delete(@incoming_sid).should == response
    WebMock.should have_requested(:delete, url)
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
twilio-3.1.0 spec/twilio/incoming_phone_number_spec.rb
slayer-twilio-3.0.1 spec/twilio/incoming_phone_number_spec.rb
twilio-3.0.1 spec/twilio/incoming_phone_number_spec.rb
twilio-3.0.0 spec/twilio/incoming_phone_number_spec.rb