Sha256: fb0538f9c4effea5c95a39896bb75f1cd8cc7330bfe2a0f2f2a773ba65aa28bf

Contents?: true

Size: 1.31 KB

Versions: 9

Compression:

Stored size: 1.31 KB

Contents

describe ChatWork::Client::MemberMethods do
  describe "#get_members", type: :api do
    subject { client.get_members(room_id: room_id, &block) }

    let(:room_id) { 123 }

    before do
      stub_chatwork_request(:get, "/rooms/#{room_id}/members", "/rooms/{room_id}/members")
    end

    it_behaves_like :a_chatwork_api, :get, "/rooms/{room_id}/members"
  end

  describe "#update_all_members", type: :api do
    subject do
      client.update_all_members(
        room_id:              room_id,
        members_admin_ids:    members_admin_ids,
        members_member_ids:   members_member_ids,
        members_readonly_ids: members_readonly_ids,
        &block
      )
    end

    let(:room_id) { 123 }

    before do
      stub_chatwork_request(:put, "/rooms/#{room_id}/members", "/rooms/{room_id}/members")
    end

    context "with String" do
      let(:members_admin_ids)    { "123,542,1001" }
      let(:members_member_ids)   { "21,344" }
      let(:members_readonly_ids) { "15,103" }

      it_behaves_like :a_chatwork_api, :put, "/rooms/{room_id}/members"
    end

    context "with Array" do
      let(:members_admin_ids)    { [123, 542, 1001] }
      let(:members_member_ids)   { [21, 344] }
      let(:members_readonly_ids) { [15, 103] }

      it_behaves_like :a_chatwork_api, :put, "/rooms/{room_id}/members"
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
chatwork-1.0.0 spec/lib/chatwork/client/member_methods_spec.rb
chatwork-0.12.3 spec/lib/chatwork/client/member_methods_spec.rb
chatwork-0.12.2 spec/lib/chatwork/client/member_methods_spec.rb
chatwork-0.12.1 spec/lib/chatwork/client/member_methods_spec.rb
chatwork-0.12.0 spec/lib/chatwork/client/member_methods_spec.rb
chatwork-0.11.0 spec/lib/chatwork/client/member_methods_spec.rb
chatwork-0.10.0 spec/lib/chatwork/client/member_methods_spec.rb
chatwork-0.9.0 spec/lib/chatwork/client/member_methods_spec.rb
chatwork-0.8.0 spec/lib/chatwork/client/member_methods_spec.rb