Sha256: f28eefb5ec18e83a175d8460715ad0744c3210dfbd10cccfdd5ca222d8b91814

Contents?: true

Size: 1.21 KB

Versions: 7

Compression:

Stored size: 1.21 KB

Contents

# frozen_string_literal: true

require 'spec_helper'

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

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

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

      it 'returns the http status code as a number' do
        expect(zc.user_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[: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_delete(args) }.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/delete_spec.rb
zoom_rb-0.8.7 spec/lib/zoom/actions/user/delete_spec.rb
zoom_rb-0.8.6 spec/lib/zoom/actions/user/delete_spec.rb
zoom_rb-0.8.5 spec/lib/zoom/actions/user/delete_spec.rb
zoom_rb-0.8.4 spec/lib/zoom/actions/user/delete_spec.rb
zoom_rb-0.8.3 spec/lib/zoom/actions/user/delete_spec.rb
zoom_rb-0.8.2 spec/lib/zoom/actions/user/delete_spec.rb