Sha256: 3183deb48366f8d2bcfebc9bed29a4f7841d3ab21965d2f53c3d8c046180eb4a

Contents?: true

Size: 1.41 KB

Versions: 16

Compression:

Stored size: 1.41 KB

Contents

# frozen_string_literal: true

require 'spec_helper'

describe Zoom::Actions::SipAudio do
  let(:zc) { zoom_client }
  let(:args) { { account_id: '1' } }

  describe '#sip_trunks_get action' do
    context 'with a valid response' do
      before :each do
        stub_request(
          :get,
          zoom_url("/accounts/#{args[:account_id]}/sip_trunk/trunks")
          ).to_return(status: 200,
                      body: json_response('sip_audio', 'sip_trunks_get'),
                      headers: { 'Content-Type' => 'application/json' })
      end

      it 'requires id param' do
        expect { zc.sip_trunks_get }.to raise_error(Zoom::ParameterMissing, [:account_id].to_s)
      end

      it 'returns a hash' do
        expect(zc.sip_trunks_get(args)).to be_kind_of(Hash)
      end

      it 'returns same params' do
        res = zc.sip_trunks_get(args)

        expect(res.keys).to match_array(%w[sip_trunks total_records])
      end
    end

    context 'with a 4xx response' do
      before :each do
        stub_request(
          :get,
          zoom_url("/accounts/#{args[:account_id]}/sip_trunk/trunks")
        ).to_return(status: 404,
                    body: json_response('error', 'validation'),
                    headers: { 'Content-Type' => 'application/json' })
      end

      it 'raises Zoom::Error exception' do
        expect { zc.sip_trunks_get(args) }.to raise_error(Zoom::Error)
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
zoom_rb-1.1.11 spec/lib/zoom/actions/sip_audio/get_trunks_spec.rb
zoom_rb-1.1.10 spec/lib/zoom/actions/sip_audio/get_trunks_spec.rb
zoom_rb-1.1.9 spec/lib/zoom/actions/sip_audio/get_trunks_spec.rb
zoom_rb-1.1.8 spec/lib/zoom/actions/sip_audio/get_trunks_spec.rb
zoom_rb-1.1.7 spec/lib/zoom/actions/sip_audio/get_trunks_spec.rb
zoom_rb-1.1.6 spec/lib/zoom/actions/sip_audio/get_trunks_spec.rb
zoom_rb-1.1.5 spec/lib/zoom/actions/sip_audio/get_trunks_spec.rb
zoom_rb-1.1.4 spec/lib/zoom/actions/sip_audio/get_trunks_spec.rb
zoom_rb-1.1.3 spec/lib/zoom/actions/sip_audio/get_trunks_spec.rb
zoom_rb-1.1.2 spec/lib/zoom/actions/sip_audio/get_trunks_spec.rb
zoom_rb-1.1.1 spec/lib/zoom/actions/sip_audio/get_trunks_spec.rb
zoom_rb-1.1.0 spec/lib/zoom/actions/sip_audio/get_trunks_spec.rb
zoom_rb-1.0.2 spec/lib/zoom/actions/sip_audio/get_trunks_spec.rb
zoom_rb-1.0.1 spec/lib/zoom/actions/sip_audio/get_trunks_spec.rb
zoom_rb-1.0.0 spec/lib/zoom/actions/sip_audio/get_trunks_spec.rb
zoom_rb-0.11.0 spec/lib/zoom/actions/sip_audio/get_trunks_spec.rb