Sha256: 25f90052047485709ace3e038fa7a39071b08ef6ffc6e802bd6d55f9a5d54bcd

Contents?: true

Size: 1.05 KB

Versions: 2

Compression:

Stored size: 1.05 KB

Contents

require 'spec_helper'

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

  it 'gets phone numbers without special encoding' do
    number = '+13123131434'
    client = TwilioLookups::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 = TwilioLookups::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

2 entries across 2 versions & 1 rubygems

Version Path
twilio-lookups-0.0.2 spec/rest/phone_number_spec.rb
twilio-lookups-0.0.1 spec/rest/phone_number_spec.rb