Sha256: a87a78106619dee116acb56010da4271fc0fe9883acbb0e5cc73f5d2473c8c12

Contents?: true

Size: 1.39 KB

Versions: 16

Compression:

Stored size: 1.39 KB

Contents

# frozen_string_literal: true

require 'spec_helper'

describe Zoom::Actions::User do
  let(:zc) { zoom_client }
  let(:args) { { vanity_name: 'foobar' } }

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

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

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

      it 'returns expected value' do
        res = zc.user_vanity_name(args)

        expect(res['existed']).to be true
      end
    end

    context 'with a 4xx response' do
      before :each do
        stub_request(
          :get,
          zoom_url('/users/vanity_name')
        ).to_return(status: 400,
                    body: json_response('error', 'validation'),
                    headers: { 'Content-Type' => 'application/json' })
      end

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