Sha256: 7b1fcc6ea5564277fed8839c5ac867ac84cc4cccba3f6d831f5a61e331f9e936

Contents?: true

Size: 1.61 KB

Versions: 18

Compression:

Stored size: 1.61 KB

Contents

# frozen_string_literal: true

require 'spec_helper'

describe Zoom::Actions::User do
  let(:zc) { zoom_client }
  let(:args) { { id: 'ufR9342pRyf8ePFN92dttQ' } }

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

      it 'requires id param' do
        expect { zc.user_settings_get(filter_key(args, :id)) }.to raise_error(Zoom::ParameterMissing, '[:id]')
      end

      it 'allowes login_type' do
        args[:login_type] = 0
        expect { zc.user_settings_get(args) }.not_to raise_error
      end


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

      it 'returns same params' do
        res = zc.user_settings_get(args)

        expect(res.keys).to match_array(['scheduled_meeting', 'in_meeting', 'email_notification', 'recording', 'telephony', 'tsp', 'feature'])
      end
    end

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

      it 'raises Zoom::Error exception' do
        expect { zc.user_settings_get(args) }.to raise_error(Zoom::Error)
      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/user/settings_get_spec.rb
zoom_rb-1.1.10 spec/lib/zoom/actions/user/settings_get_spec.rb
zoom_rb-1.1.9 spec/lib/zoom/actions/user/settings_get_spec.rb
zoom_rb-1.1.8 spec/lib/zoom/actions/user/settings_get_spec.rb
zoom_rb-1.1.7 spec/lib/zoom/actions/user/settings_get_spec.rb
zoom_rb-1.1.6 spec/lib/zoom/actions/user/settings_get_spec.rb
zoom_rb-1.1.5 spec/lib/zoom/actions/user/settings_get_spec.rb
zoom_rb-1.1.4 spec/lib/zoom/actions/user/settings_get_spec.rb
zoom_rb-1.1.3 spec/lib/zoom/actions/user/settings_get_spec.rb
zoom_rb-1.1.2 spec/lib/zoom/actions/user/settings_get_spec.rb
zoom_rb-1.1.1 spec/lib/zoom/actions/user/settings_get_spec.rb
zoom_rb-1.1.0 spec/lib/zoom/actions/user/settings_get_spec.rb
zoom_rb-1.0.2 spec/lib/zoom/actions/user/settings_get_spec.rb
zoom_rb-1.0.1 spec/lib/zoom/actions/user/settings_get_spec.rb
zoom_rb-1.0.0 spec/lib/zoom/actions/user/settings_get_spec.rb
zoom_rb-0.11.0 spec/lib/zoom/actions/user/settings_get_spec.rb
zoom_markazuna-0.10.0 spec/lib/zoom/actions/user/settings_get_spec.rb
zoom_rb-0.10.0 spec/lib/zoom/actions/user/settings_get_spec.rb