Sha256: d13a744a9aa0a1432c7e63af5d03748c4111f23eece281507e447819021ab416

Contents?: true

Size: 1.07 KB

Versions: 2

Compression:

Stored size: 1.07 KB

Contents

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

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

    let(:room_id)    { 123 }
    let(:account_id) { 101 }

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

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

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

    let(:room_id) { 123 }
    let(:file_id) { 101 }

    context "when force is Integer" do
      let(:create_download_url) { 1 }

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

    context "when force is boolean" do
      let(:create_download_url) { true }

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
chatwork-0.9.0 spec/lib/chatwork/client/file_methods_spec.rb
chatwork-0.8.0 spec/lib/chatwork/client/file_methods_spec.rb