Sha256: 9652a2035e2cf7bdce9ed8531d0cb587462dfca384e6f5c8e4607c23af5f42b7

Contents?: true

Size: 1.9 KB

Versions: 10

Compression:

Stored size: 1.9 KB

Contents

describe ChatWork::InvitationLink do
  describe ".get", type: :api do
    subject { ChatWork::InvitationLink.get(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", type: :api do
    subject do
      ChatWork::InvitationLink.create(
        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", type: :api do
    subject do
      ChatWork::InvitationLink.update(
        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", type: :api do
    subject { ChatWork::InvitationLink.destroy(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

10 entries across 10 versions & 1 rubygems

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