Sha256: 314861059e7f7785c5b47cdfa1aba6436920f87540a27591b0925de5f880ffdd

Contents?: true

Size: 1.53 KB

Versions: 16

Compression:

Stored size: 1.53 KB

Contents

# frozen_string_literal: true

require 'spec_helper'

describe Zoom::Actions::User do
  let(:zc) { zoom_client }
  let(:args) { { user_id: 'ufR93M2pRyy8ePFN92dttq' } }

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

      it "requires user_id param" do
        expect {
          zc.user_schedulers_list(filter_key(args, :user_id))
        }.to raise_error(Zoom::ParameterMissing, [:user_id].to_s)
      end

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

      it "returns 'schedulers' count" do
        expect(zc.user_schedulers_list(args)['schedulers'].count).to eq(2)
      end

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

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

      it 'raises Zoom::Error exception' do
        expect { zc.user_schedulers_list(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/user/scheduler/list_spec.rb
zoom_rb-1.1.10 spec/lib/zoom/actions/user/scheduler/list_spec.rb
zoom_rb-1.1.9 spec/lib/zoom/actions/user/scheduler/list_spec.rb
zoom_rb-1.1.8 spec/lib/zoom/actions/user/scheduler/list_spec.rb
zoom_rb-1.1.7 spec/lib/zoom/actions/user/scheduler/list_spec.rb
zoom_rb-1.1.6 spec/lib/zoom/actions/user/scheduler/list_spec.rb
zoom_rb-1.1.5 spec/lib/zoom/actions/user/scheduler/list_spec.rb
zoom_rb-1.1.4 spec/lib/zoom/actions/user/scheduler/list_spec.rb
zoom_rb-1.1.3 spec/lib/zoom/actions/user/scheduler/list_spec.rb
zoom_rb-1.1.2 spec/lib/zoom/actions/user/scheduler/list_spec.rb
zoom_rb-1.1.1 spec/lib/zoom/actions/user/scheduler/list_spec.rb
zoom_rb-1.1.0 spec/lib/zoom/actions/user/scheduler/list_spec.rb
zoom_rb-1.0.2 spec/lib/zoom/actions/user/scheduler/list_spec.rb
zoom_rb-1.0.1 spec/lib/zoom/actions/user/scheduler/list_spec.rb
zoom_rb-1.0.0 spec/lib/zoom/actions/user/scheduler/list_spec.rb
zoom_rb-0.11.0 spec/lib/zoom/actions/user/scheduler/list_spec.rb