Sha256: e046c3b1cecb9a2d339fa463028c4d63f7b4b90b1f71d1320969fb8e48dea6e3

Contents?: true

Size: 1.48 KB

Versions: 16

Compression:

Stored size: 1.48 KB

Contents

# frozen_string_literal: true

require 'spec_helper'

describe Zoom::Actions::User do
  let(:zc) { zoom_client }
  let(:args) { { user_id: 'eIimBAXqSrWOcB_EOIXTog', assistant_id: '555' } }

  describe '#user_assistants_delete' do
    context 'with a 204 response' do
      before :each do
        stub_request(
          :delete,
          zoom_url("/users/#{args[:user_id]}/assistants/#{args[:assistant_id]}")
        ).to_return(status: 204)
      end

      it 'requires user_id param' do
        expect do
          zc.user_assistants_delete(filter_key(args, :user_id))
        end.to raise_error(Zoom::ParameterMissing, [:user_id].to_s)
      end

      it 'requires assistant_id param' do
        expect do
          zc.user_assistants_delete(filter_key(args, :assistant_id))
        end.to raise_error(Zoom::ParameterMissing, [:assistant_id].to_s)
      end

      it 'returns the http status code as a number' do
        expect(zc.user_assistants_delete(args)).to eql(204)
      end
    end

    context 'with a 4xx when the user is not found' do
      before :each do
        stub_request(
          :delete,
          zoom_url("/users/#{args[:user_id]}/assistants/#{args[:assistant_id]}")
        ).to_return(status: 404,
                    body: json_response('error', 'not_found'),
                    headers: { 'Content-Type' => 'application/json' })
      end

      it 'raises an error' do
        expect { zc.user_assistants_delete(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/assistant/delete_spec.rb
zoom_rb-1.1.10 spec/lib/zoom/actions/user/assistant/delete_spec.rb
zoom_rb-1.1.9 spec/lib/zoom/actions/user/assistant/delete_spec.rb
zoom_rb-1.1.8 spec/lib/zoom/actions/user/assistant/delete_spec.rb
zoom_rb-1.1.7 spec/lib/zoom/actions/user/assistant/delete_spec.rb
zoom_rb-1.1.6 spec/lib/zoom/actions/user/assistant/delete_spec.rb
zoom_rb-1.1.5 spec/lib/zoom/actions/user/assistant/delete_spec.rb
zoom_rb-1.1.4 spec/lib/zoom/actions/user/assistant/delete_spec.rb
zoom_rb-1.1.3 spec/lib/zoom/actions/user/assistant/delete_spec.rb
zoom_rb-1.1.2 spec/lib/zoom/actions/user/assistant/delete_spec.rb
zoom_rb-1.1.1 spec/lib/zoom/actions/user/assistant/delete_spec.rb
zoom_rb-1.1.0 spec/lib/zoom/actions/user/assistant/delete_spec.rb
zoom_rb-1.0.2 spec/lib/zoom/actions/user/assistant/delete_spec.rb
zoom_rb-1.0.1 spec/lib/zoom/actions/user/assistant/delete_spec.rb
zoom_rb-1.0.0 spec/lib/zoom/actions/user/assistant/delete_spec.rb
zoom_rb-0.11.0 spec/lib/zoom/actions/user/assistant/delete_spec.rb