Sha256: fe4c5b4761f70ffa0bbacc455f39ac1833eb510d621420c53ffceb3d91c1dbe9

Contents?: true

Size: 1.39 KB

Versions: 19

Compression:

Stored size: 1.39 KB

Contents

# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Zoom::Actions::Webinar do
  let(:zc) { zoom_client }
  let(:args) { { host_id: 'test_user_id' } }

  describe '#webinar_list' do
    context 'with a valid response' do
      before :each do
        stub_request(
          :get,
          zoom_url("/users/#{args[:host_id]}/webinars")
        ).to_return(body: json_response('webinar', 'list'),
                    headers: { 'Content-Type' => 'application/json' })
      end

      it "requires a 'host_id' argument" do
        expect { zc.webinar_list }.to raise_error(Zoom::ParameterMissing, [:host_id].to_s)
      end

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

      it "returns 'total_records'" do
        expect(zc.webinar_list(args)['total_records']).to eq(1)
      end

      it "returns 'webinars' Array" do
        expect(zc.webinar_list(args)['webinars']).to be_kind_of(Array)
      end
    end

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

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

Version data entries

19 entries across 19 versions & 2 rubygems

Version Path
zoom_rb-1.1.11 spec/lib/zoom/actions/webinar/list_spec.rb
zoom_rb-1.1.10 spec/lib/zoom/actions/webinar/list_spec.rb
zoom_rb-1.1.9 spec/lib/zoom/actions/webinar/list_spec.rb
zoom_rb-1.1.8 spec/lib/zoom/actions/webinar/list_spec.rb
zoom_rb-1.1.7 spec/lib/zoom/actions/webinar/list_spec.rb
zoom_rb-1.1.6 spec/lib/zoom/actions/webinar/list_spec.rb
zoom_rb-1.1.5 spec/lib/zoom/actions/webinar/list_spec.rb
zoom_rb-1.1.4 spec/lib/zoom/actions/webinar/list_spec.rb
zoom_rb-1.1.3 spec/lib/zoom/actions/webinar/list_spec.rb
zoom_rb-1.1.2 spec/lib/zoom/actions/webinar/list_spec.rb
zoom_rb-1.1.1 spec/lib/zoom/actions/webinar/list_spec.rb
zoom_rb-1.1.0 spec/lib/zoom/actions/webinar/list_spec.rb
zoom_rb-1.0.2 spec/lib/zoom/actions/webinar/list_spec.rb
zoom_rb-1.0.1 spec/lib/zoom/actions/webinar/list_spec.rb
zoom_rb-1.0.0 spec/lib/zoom/actions/webinar/list_spec.rb
zoom_rb-0.11.0 spec/lib/zoom/actions/webinar/list_spec.rb
zoom_markazuna-0.10.0 spec/lib/zoom/actions/webinar/list_spec.rb
zoom_rb-0.10.0 spec/lib/zoom/actions/webinar/list_spec.rb
zoom_rb-0.9.1 spec/lib/zoom/actions/webinar/list_spec.rb