Sha256: b3853d8c030f24fb9c585d416a02b588fb7c686b1080a908d83c00d63a79a6ee

Contents?: true

Size: 1.11 KB

Versions: 1

Compression:

Stored size: 1.11 KB

Contents

require File.expand_path("../../spec_helper", __FILE__)

RSpec.describe Attachie::FileDriver do
  let(:driver) { Attachie::FileDriver.new("/tmp/attachie") }

  it "should store a blob" do
    begin
      driver.store("name", "blob", "bucket")

      expect(driver.exists?("name", "bucket")).to be(true)
      expect(driver.value("name", "bucket")).to eq("blob")
    ensure
      driver.delete("name", "bucket")
    end
  end

  it "should store a blob via multipart upload" do
    begin
      driver.store_multipart("name", "bucket") do |upload|
        upload.upload_part("chunk1")
        upload.upload_part("chunk2")
      end

      expect(driver.exists?("name", "bucket")).to be(true)
      expect(driver.value("name", "bucket")).to eq("chunk1chunk2")
    ensure
      driver.delete("name", "bucket")
    end
  end

  it "should delete a blob" do
    begin
      driver.store("name", "blob", "bucket")
      expect(driver.exists?("name", "bucket")).to be(true)

      driver.delete("name", "bucket")
      expect(driver.exists?("name", "bucket")).to be(false)
    ensure
      driver.delete("name", "bucket")
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
attachie-0.0.1 spec/attachie/file_driver_spec.rb