Sha256: fc051021ee7657ce86adc43c9a293eaefa00094d864748a9fe034f25d1da994c

Contents?: true

Size: 1.97 KB

Versions: 9

Compression:

Stored size: 1.97 KB

Contents

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

    let(:room_id) { 123 }

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

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

  describe "#create_invitation_link", type: :api do
    subject do
      client.create_invitation_link(
        room_id:         room_id,
        code:            code,
        description:     description,
        need_acceptance: need_acceptance,
        &block
      )
    end

    let(:room_id)         { 123 }
    let(:code)            { "unique-link-name" }
    let(:description)     { "This is a public room for topic A." }
    let(:need_acceptance) { true }

    before do
      stub_chatwork_request(:post, "/rooms/#{room_id}/link", "/rooms/{room_id}/link")
    end

    it_behaves_like :a_chatwork_api, :post, "/rooms/{room_id}/link"
  end

  describe "#update_invitation_link", type: :api do
    subject do
      client.update_invitation_link(
        room_id:         room_id,
        code:            code,
        description:     description,
        need_acceptance: need_acceptance,
        &block
      )
    end

    let(:room_id)         { 123 }
    let(:code)            { "another_link_name" }
    let(:description)     { "Public room for everybody" }
    let(:need_acceptance) { false }

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

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

  describe "#destroy_invitation_link", type: :api do
    subject { client.destroy_invitation_link(room_id: room_id, &block) }

    let(:room_id) { 123 }

    before do
      stub_chatwork_request(:delete, "/rooms/#{room_id}/link", "/rooms/{room_id}/link")
    end

    it_behaves_like :a_chatwork_api, :delete, "/rooms/{room_id}/link"
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

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