Sha256: 893de7794457399dc8dc87525eb2594b981acf1206b12e16f181de15b6bfa088

Contents?: true

Size: 1.16 KB

Versions: 13

Compression:

Stored size: 1.16 KB

Contents

module Adhoq
  RSpec.describe Storage, type: :model do
    describe Storage::LocalFile do
      tempdir = __dir__ + '/../../tmp/adhoq_storage.test'

      after(:all) do
        FileUtils.rm_rf(tempdir)
      end

      let(:storage) { Storage::LocalFile.new(tempdir) }

      let(:identifier) do
        storage.store('.txt') { StringIO.new("Hello adhoq!\n") }
      end

      specify { expect(storage.get(identifier)).to eq "Hello adhoq!\n" }
    end

    describe Storage::S3, :fog_mock do
      let(:storage) { Storage::S3.new('my-adhoq-bucket', aws_access_key_id: 'key_id', aws_secret_access_key: 'access_key') }

      let(:identifier) do
        storage.store('.txt') { StringIO.new("Hello adhoq!\n") }
      end

      specify { expect(storage.get(identifier)).to eq "Hello adhoq!\n" }
    end

    describe Storage::OnTheFly do
      let(:storage) { Storage::OnTheFly.new }

      let!(:identifier) do
        storage.store('.txt') { StringIO.new("Hello adhoq!\n") }
      end

      specify { expect(storage.get(identifier)).to eq "Hello adhoq!\n" }

      specify do
        expect { storage.get(identifier) }.to change { storage.reports.size }.by(-1)
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
adhoq-1.0.2 spec/adhoq/storage_spec.rb
adhoq-1.0.1 spec/adhoq/storage_spec.rb
adhoq-1.0.0 spec/adhoq/storage_spec.rb
adhoq-0.5.0 spec/adhoq/storage_spec.rb
adhoq-0.5.0.beta1 spec/adhoq/storage_spec.rb
adhoq-0.4.0 spec/adhoq/storage_spec.rb
adhoq-0.3.0 spec/adhoq/storage_spec.rb
adhoq-0.2.0 spec/adhoq/storage_spec.rb
adhoq-0.1.2 spec/adhoq/storage_spec.rb
adhoq-0.1.1 spec/adhoq/storage_spec.rb
adhoq-0.1.0 spec/adhoq/storage_spec.rb
adhoq-0.0.7 spec/adhoq/storage_spec.rb
adhoq-0.0.6 spec/adhoq/storage_spec.rb