Sha256: 06c897cf70a7f49c39c2215cf464f0820a1a4c0a5007bbaef4fa689f8ec92c2b

Contents?: true

Size: 1.06 KB

Versions: 1

Compression:

Stored size: 1.06 KB

Contents

# frozen_string_literal: true

require 'spec_helper'

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

  describe '#webinar_registrants_list' do
    before :each do
      stub_request(
        :get,
        zoom_url("/webinars/#{args[:id]}/registrants")
      ).to_return(body: json_response('webinar', 'registrant', 'list'))
    end

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

    it 'returns an Array of registrants' do
      expect(zc.webinar_registrants_list(args)['registrants']).to be_kind_of(Array)
    end
  end

  describe '#webinar_registrants_list!' do
    before :each do
      stub_request(
        :get,
        zoom_url("/webinars/#{args[:id]}/registrants")
      ).to_return(status: 404, body: json_response('error', 'validation'))
    end

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
zoom_rb-0.8.1 spec/lib/zoom/actions/webinar/registrants/list_spec.rb