Sha256: bbbf710b1d3ae77284e711d9e1bd6cd5e9f8c175fc915b3100e0625b680f8b33

Contents?: true

Size: 1.09 KB

Versions: 3

Compression:

Stored size: 1.09 KB

Contents

require 'right_publish/stores/s3'
require 'spec_helper'

describe RightPublish::S3Storage do

  before(:each) do
    flexmock(RightPublish::Profile) do |obj|
      obj.should_receive(:log).and_return { |str,dbg|
      }

      obj.should_receive(:config).and_return {
        { :verbose=>false,
          :remote_storage=>{:provider=>'s3',:remote_path=>'foo/'},
          :local_storage=>{:provider=>'mocklocal'}
        }
      }
    end

    fog = flexmock(Fog::Storage)
    fog.should_receive(:new).and_return do
      conn = flexmock('Connection')
      conn.should_receive(:directories).and_return do
        buckets = flexmock('Buckets')
        buckets.should_receive(:get).and_return do
          dir = flexmock('Directory')
          dir
        end
        buckets
      end
      conn
    end
  end

  context ".compute_md5" do
    it "uses the etag field to compute the MD5 sum" do
      file = flexmock('File') do |obj|
        obj.should_receive(:etag).once.and_return("MD5")
      end

      dir = RightPublish::S3Storage.get_directories
      dir.compute_md5(file).should be_eql("MD5")
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
right_publish-0.3.0 spec/stores/s3_spec.rb
right_publish-0.2.1 spec/stores/s3_spec.rb
right_publish-0.2.0 spec/stores/s3_spec.rb