Sha256: 92e1ec5270a3fdb17345b86d5fd4e25007f977d5186404ec0e3fcd90e8759031

Contents?: true

Size: 1.31 KB

Versions: 7

Compression:

Stored size: 1.31 KB

Contents

# frozen_string_literal: true

require 'spec_helper'

describe Zoom::Actions::User do
  let(:zc) { zoom_client }

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

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

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

      it "returns 'users' Array" do
        expect(zc.user_list['users']).to be_kind_of(Array)
      end

      it 'raises an error when passed an invalid option' do
        expect { zc.user_list(foo: 'bar', status: 'active') }.to raise_error(Zoom::ParameterNotPermitted, [:foo].to_s)
      end
    end

    context 'with a 4xx response' do
      before :each do
        stub_request(
          :get,
          zoom_url('/users')
        ).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_list }.to raise_error(Zoom::Error)
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
zoom_rb-0.9.0 spec/lib/zoom/actions/user/list_spec.rb
zoom_rb-0.8.7 spec/lib/zoom/actions/user/list_spec.rb
zoom_rb-0.8.6 spec/lib/zoom/actions/user/list_spec.rb
zoom_rb-0.8.5 spec/lib/zoom/actions/user/list_spec.rb
zoom_rb-0.8.4 spec/lib/zoom/actions/user/list_spec.rb
zoom_rb-0.8.3 spec/lib/zoom/actions/user/list_spec.rb
zoom_rb-0.8.2 spec/lib/zoom/actions/user/list_spec.rb