Sha256: d385b527420b5dd0eac26a4b9f7f435a89f1635237784fd0ce6a750cf70a60e0

Contents?: true

Size: 1.77 KB

Versions: 18

Compression:

Stored size: 1.77 KB

Contents

# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Zoom::Actions::Webinar do

  [:jwt_client, :oauth_client].each do |client|
    describe "#{client}" do
      let(:zc) { send(client) }
      let(:args) { { host_id: 'test_user_id' } }

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

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

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

          it 'returns the setted params' do
            res = zc.webinar_create(args)
            expect(res['host_id']).to eq(args[:host_id])
          end

          it "returns 'start_url' and 'join_url'" do
            res = zc.webinar_create(args)

            expect(res['start_url']).to_not be_nil
            expect(res['join_url']).to_not be_nil
          end
        end

        context 'with a 4xx response' do
          before :each do
            stub_request(
              :post,
              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_create(args) }.to raise_error(Zoom::Error)
          end
        end
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 2 rubygems

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