Sha256: 094065bfbdd27d76e47ebee5e2316e82f0506ab5e08e969f6bcd74e594ddd942

Contents?: true

Size: 925 Bytes

Versions: 2

Compression:

Stored size: 925 Bytes

Contents

require 'spec_helper'

RSpec.describe RockRMS::Client::PhoneNumber, type: :model do
  include_context 'resource specs'

  describe '#list_phone_numbers(options = {})' do
    subject(:resource) { client.list_phone_numbers }

    it 'returns a array of hashes' do
      expect(resource).to be_a(Array)
      expect(resource.first).to be_a(Hash)
    end

    it 'queries phone numbers' do
      expect(client).to receive(:get).with('PhoneNumbers', {})
        .and_call_original
      resource
    end

    it 'passes options' do
      expect(client).to receive(:get)
        .with('PhoneNumbers', { option1: '1' })
        .and_return([])
      client.list_phone_numbers(option1: '1')
    end

    it 'formats with PhoneNumber' do
      response = double
      expect(RockRMS::Responses::PhoneNumber).to receive(:format).with(response)
      allow(client).to receive(:get).and_return(response)
      resource
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rock_rms-1.2.0 spec/rock_rms/resources/phone_number_spec.rb
rock_rms-1.1.0 spec/rock_rms/resources/phone_number_spec.rb