Sha256: 3f8bc5a23399b5d1be5a2045c742b1ed3fdb4dfcab3427b887595d01f1302236

Contents?: true

Size: 1.14 KB

Versions: 16

Compression:

Stored size: 1.14 KB

Contents

# frozen_string_literal: true

require 'spec_helper'

describe Zoom::Actions::User do
  let(:zc) { zoom_client }
  let(:args) { { email: 'test@example.com' } }

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

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

      it "returns 'existed_email'" do
        expect(zc.user_email_check(args)['existed_email']).to be_truthy
      end
    end

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

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