Sha256: b2d5ea4a91fb91a8fb9974b4a175ab618daccfbf378cf04a2654d93fd232e55e

Contents?: true

Size: 1.03 KB

Versions: 25

Compression:

Stored size: 1.03 KB

Contents

require 'spec_helper'

describe Twilio::REST::Lookups::PhoneNumbers do
  it 'creates a phone_number object' do
    client = Twilio::REST::LookupsClient.new 'otherSid', 'otherToken'
    expect(client).to respond_to(:phone_numbers)
  end

  it 'gets phone numbers without special encoding' do
    number = '+13123131434'
    client = Twilio::REST::LookupsClient.new 'otherSid', 'otherToken'
    expect(client).to receive(:get).once
      .with('/v1/PhoneNumbers/+13123131434')
      .and_return({ phone_number: number })
    phone_number = client.phone_numbers.get('+13123131434').phone_number
    expect(phone_number).to be(number)
  end

  it 'URI encodes phone number path parameters' do
    number = '+13123131434'
    client = Twilio::REST::LookupsClient.new 'otherSid', 'otherToken'
    expect(client).to receive(:get).once
      .with('/v1/PhoneNumbers/+1%20312%20313%201434')
      .and_return({ phone_number: number })
    phone_number = client.phone_numbers.get('+1 312 313 1434').phone_number
    expect(phone_number).to be(number)
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
twilio-ruby-4.6.0.edge spec/rest/lookups/phone_number_spec.rb
twilio-ruby-4.5.0 spec/rest/lookups/phone_number_spec.rb
twilio-ruby-4.4.0 spec/rest/lookups/phone_number_spec.rb
twilio-ruby-4.3.0 spec/rest/lookups/phone_number_spec.rb
twilio-ruby-4.2.1 spec/rest/lookups/phone_number_spec.rb