Sha256: b4b7f9eb3c885469daf86b6cb960f9b653eee4fae91826ddc888e24899c68edc

Contents?: true

Size: 1.71 KB

Versions: 27

Compression:

Stored size: 1.71 KB

Contents

# frozen_string_literal: true

require 'spec_helper'

xdescribe Zoom::Actions::IM::Chat do
  let(:zc) { zoom_client }
  let(:args) { { access_token: 'foobar',
                 session_id: '123456',
                 from: '2018-08-28',
                 to: '2018-08-29' } }
  let(:response) { zc.chat_get(args) }

  xdescribe '#chat_get action' do
    before :each do
      stub_request(
        :post,
        zoom_url('/chat/get')
      ).to_return(body: json_response('chat','get'))
    end

    it "requires a 'access_token' argument" do
      expect { zc.chat_get(filter_key(args, :access_token)) }.to raise_error(ArgumentError)
    end

    it "requires a 'session_id' argument" do
      expect { zc.chat_get(filter_key(args, :session_id)) }.to raise_error(ArgumentError)
    end

    it "requires a 'from' argument" do
      expect { zc.chat_get(filter_key(args, :from)) }.to raise_error(ArgumentError)
    end

    it "requires a 'to' argument" do
      expect { zc.chat_get(filter_key(args, :to)) }.to raise_error(ArgumentError)
    end

    it 'returns a hash' do
      expect(response).to be_kind_of(Hash)
    end

    it 'returns an Array of chat_messages' do
      expect(response['chat_messages']).to be_kind_of(Array)
    end

    it 'returns the params' do
      expect(response['session_id']).to eql(args[:session_id])
      expect(response['from']).to eql(args[:from])
      expect(response['to']).to eql(args[:to])
    end
  end

  xdescribe '#chat_get! action' do
    before :each do
      stub_request(
        :post,
        zoom_url('/chat/get')
      ).to_return(body: json_response('error'))
    end

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

Version data entries

27 entries across 27 versions & 2 rubygems

Version Path
zoom_rb-1.1.11 spec/lib/zoom/actions/im/chat/get_spec.rb
zoom_rb-1.1.10 spec/lib/zoom/actions/im/chat/get_spec.rb
zoom_rb-1.1.9 spec/lib/zoom/actions/im/chat/get_spec.rb
zoom_rb-1.1.8 spec/lib/zoom/actions/im/chat/get_spec.rb
zoom_rb-1.1.7 spec/lib/zoom/actions/im/chat/get_spec.rb
zoom_rb-1.1.6 spec/lib/zoom/actions/im/chat/get_spec.rb
zoom_rb-1.1.5 spec/lib/zoom/actions/im/chat/get_spec.rb
zoom_rb-1.1.4 spec/lib/zoom/actions/im/chat/get_spec.rb
zoom_rb-1.1.3 spec/lib/zoom/actions/im/chat/get_spec.rb
zoom_rb-1.1.2 spec/lib/zoom/actions/im/chat/get_spec.rb
zoom_rb-1.1.1 spec/lib/zoom/actions/im/chat/get_spec.rb
zoom_rb-1.1.0 spec/lib/zoom/actions/im/chat/get_spec.rb
zoom_rb-1.0.2 spec/lib/zoom/actions/im/chat/get_spec.rb
zoom_rb-1.0.1 spec/lib/zoom/actions/im/chat/get_spec.rb
zoom_rb-1.0.0 spec/lib/zoom/actions/im/chat/get_spec.rb
zoom_rb-0.11.0 spec/lib/zoom/actions/im/chat/get_spec.rb
zoom_markazuna-0.10.0 spec/lib/zoom/actions/im/chat/get_spec.rb
zoom_rb-0.10.0 spec/lib/zoom/actions/im/chat/get_spec.rb
zoom_rb-0.9.1 spec/lib/zoom/actions/im/chat/get_spec.rb
zoom_rb-0.9.0 spec/lib/zoom/actions/im/chat/get_spec.rb