Sha256: 8cdf21455c8100623f74f43386780e295147e1fadbcbbd5422d460d7ef5b2733

Contents?: true

Size: 1.25 KB

Versions: 27

Compression:

Stored size: 1.25 KB

Contents

# frozen_string_literal: true

require 'spec_helper'

xdescribe Zoom::Actions::User do

  before :all do
    @zc = zoom_client
    @args = { email: 'foo@bar.com',
              login_type: 99 }
  end

  xdescribe '#user_getbyemail action' do
    before :each do
      stub_request(
        :post,
        zoom_url('/user/getbyemail')
      ).to_return(body: json_response('user', 'getbyemail'))
    end

    it 'requires email param' do
      expect { @zc.user_getbyemail(filter_key(@args, :email)) }.to raise_error(ArgumentError)
    end

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

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

      expect(res).to have_key('id')
      expect(res).to have_key('first_name')
      expect(res).to have_key('last_name')
      expect(res['email']).to eq(@args[:email])
      expect(res['type']).to eq(@args[:login_type])
    end
  end

  xdescribe '#user_getbyemail! action' do
    before :each do
      stub_request(
        :post,
        zoom_url('/user/getbyemail')
      ).to_return(body: json_response('error'))
    end

    it 'raises Zoom::Error exception' do
      expect {
        @zc.user_getbyemail!(@args)
      }.to raise_error(Zoom::Error)
    end
  end
end

Version data entries

27 entries across 27 versions & 2 rubygems

Version Path
zoom_rb-0.8.7 spec/lib/zoom/actions/user/getbyemail_spec.rb
zoom_rb-0.8.6 spec/lib/zoom/actions/user/getbyemail_spec.rb
zoom_rb-0.8.5 spec/lib/zoom/actions/user/getbyemail_spec.rb
zoom_rb-0.8.4 spec/lib/zoom/actions/user/getbyemail_spec.rb
zoom_rb-0.8.3 spec/lib/zoom/actions/user/getbyemail_spec.rb
zoom_rb-0.8.2 spec/lib/zoom/actions/user/getbyemail_spec.rb
zoom_rb-0.8.1 spec/lib/zoom/actions/user/getbyemail_spec.rb