Sha256: 3db2060002db6c5c1a07ff2f985e79a3ea1a47ef563754d8ac08b9cced951e43

Contents?: true

Size: 1.22 KB

Versions: 16

Compression:

Stored size: 1.22 KB

Contents

# frozen_string_literal: true

require 'spec_helper'

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

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

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

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

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

    context 'with a 404 response' do
      before :each do
        stub_request(
          :get,
          zoom_url("/groups")
        ).to_return(status: 404,
                    body: json_response('error', 'group_does_not_exist'),
                    headers: { 'Content-Type' => 'application/json' })
      end

      it 'raises Zoom::Error exception with text' do
        expect { zc.groups_list }.to raise_error(Zoom::Error, {
          base: 'A group with this 999999 does not exist.'
        }.to_s)
      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/groups/list_spec.rb
zoom_rb-1.1.10 spec/lib/zoom/actions/groups/list_spec.rb
zoom_rb-1.1.9 spec/lib/zoom/actions/groups/list_spec.rb
zoom_rb-1.1.8 spec/lib/zoom/actions/groups/list_spec.rb
zoom_rb-1.1.7 spec/lib/zoom/actions/groups/list_spec.rb
zoom_rb-1.1.6 spec/lib/zoom/actions/groups/list_spec.rb
zoom_rb-1.1.5 spec/lib/zoom/actions/groups/list_spec.rb
zoom_rb-1.1.4 spec/lib/zoom/actions/groups/list_spec.rb
zoom_rb-1.1.3 spec/lib/zoom/actions/groups/list_spec.rb
zoom_rb-1.1.2 spec/lib/zoom/actions/groups/list_spec.rb
zoom_rb-1.1.1 spec/lib/zoom/actions/groups/list_spec.rb
zoom_rb-1.1.0 spec/lib/zoom/actions/groups/list_spec.rb
zoom_rb-1.0.2 spec/lib/zoom/actions/groups/list_spec.rb
zoom_rb-1.0.1 spec/lib/zoom/actions/groups/list_spec.rb
zoom_rb-1.0.0 spec/lib/zoom/actions/groups/list_spec.rb
zoom_rb-0.11.0 spec/lib/zoom/actions/groups/list_spec.rb