Sha256: bc8053c6fbdad05b47bff3e18079f561fc7665effa3a5be6372d7210fd980192

Contents?: true

Size: 925 Bytes

Versions: 3

Compression:

Stored size: 925 Bytes

Contents

require "minitest_helper"

describe PgbackupsArchive::Storage do
  let(:connection) {
    Fog::Storage.new(
      :provider              => "AWS",
      :aws_access_key_id     => "XXX",
      :aws_secret_access_key => "YYY")
  }
  let(:bucket)     { connection.directories.create(:key => "someapp-backups") }
  let(:key)        { "pgbackups/test/2012-08-02-12-00-00.dump" }
  let(:file)       { "test" }
  let(:storage)    { PgbackupsArchive::Storage.new(key, file) }

  before do
    Fog.mock!
    storage.stubs(:connection).returns(connection)
    storage.stubs(:bucket).returns(bucket)
  end

  it "should create a fog connection" do
    storage.connection.class.must_equal Fog::Storage::AWS::Mock
  end

  it "should create a fog directory" do
    storage.bucket.class.must_equal Fog::Storage::AWS::Directory
  end

  it "should create a fog file" do
    storage.store.class.must_equal Fog::Storage::AWS::File
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pgbackups-archive-0.2.1 test/lib/pgbackups-archive/storage_test.rb
pgbackups-archive-0.2.0 test/lib/pgbackups-archive/storage_test.rb
pgbackups-archive-0.1.0 test/lib/pgbackups-archive/storage_test.rb