Sha256: bfb6238ab2e688240c5b1d8aa73b553497d3bdd3c2d11250cc83cd05624b991c

Contents?: true

Size: 1.41 KB

Versions: 1

Compression:

Stored size: 1.41 KB

Contents

require "spec_helper"

require "blobby"

describe Blobby do

  describe ".store" do

    context "with an absolute file path" do

      it "creates a FilesystemStore" do
        store = Blobby.store("/data")
        expect(store).to be_a(Blobby::FilesystemStore)
        expect(store.dir.to_s).to eq("/data")
      end

    end

    context "with a file:// URI" do

      it "creates a FilesystemStore" do
        store = Blobby.store("file:///data")
        expect(store).to be_a(Blobby::FilesystemStore)
        expect(store.dir.to_s).to eq("/data")
      end

    end

    context "with an http:// URI" do

      it "creates a HttpStore" do
        store = Blobby.store("http://storage.com/data/")
        expect(store).to be_a(Blobby::HttpStore)
        expect(store.base_uri.host).to eq("storage.com")
        expect(store.base_uri.path).to eq("/data/")
      end

    end

    context "with an https:// URI" do

      it "creates a HttpStore" do
        store = Blobby.store("https://storage.com/data/")
        expect(store).to be_a(Blobby::HttpStore)
        expect(store.base_uri.scheme).to eq("https")
        expect(store.base_uri.host).to eq("storage.com")
        expect(store.base_uri.path).to eq("/data/")
      end

    end

    context "with 'in-memory:/'" do

      it "creates an InMemoryStore" do
        store = Blobby.store("in-memory:/")
        expect(store).to be_a(Blobby::InMemoryStore)
      end

    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
blobby-1.1.0 spec/blobby_spec.rb