Sha256: 6ae56bf4edc58a0bce0664ebfff29f71505f48e770856c18e4c1a622078709bd

Contents?: true

Size: 1.69 KB

Versions: 8

Compression:

Stored size: 1.69 KB

Contents

require 'spec_helper.rb'

describe "An upload object" do
  before(:all) do
    class Upload
      include S3Multipart::TransferHelpers
    end
    @upload = Upload.new
  end

  it "should initiate an upload" do
    response = @upload.initiate( object_name: "example_object.wmv",
                                  content_type: "video/x-ms-wmv" )

    response["upload_id"].should be_an_instance_of(String)
    response["key"].should be_an_instance_of(String)
    response["name"].should be_an_instance_of(String)
  end

  it "should sign many parts" do
    response = @upload.sign_batch(    object_name: "example_object",
                                    content_lengths: "1000000-1000000-1000000",
                                          upload_id: "a83jrhfs94jcj3c3" ) 

    response.should be_an_instance_of(Array)
    response.first[:authorization].should match(/AWS/)
  end

  it "should sign a single part" do
    response = @upload.sign_part(   object_name: "example_object",
                                   content_length: "1000000",
                                        upload_id: "a83jrhfs94jcj3c3" ) 

    response.should be_an_instance_of(Hash)
    response[:authorization].should match(/AWS/)
  end

  it "should unsuccessfully attempt to complete an upload that doesn't exist" do
    response = @upload.complete(    object_name: "example_object",
                                   content_length: "1000000",
                                            parts: [{partNum: 1, ETag: "jf93nda3Sf8FSh"}],
                                     content_type: "application/xml",
                                        upload_id: "a83jrhfs94jcj3c3" ) 

    response[:error].should eql("Upload does not exist")
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
s3_multipart-0.0.10.5 spec/unit/upload_spec.rb
s3_multipart-0.0.10.4 spec/unit/upload_spec.rb
s3_multipart-0.0.10.3 spec/unit/upload_spec.rb
s3_multipart-0.0.10.2 spec/unit/upload_spec.rb
s3_multipart-0.0.9 spec/unit/upload_spec.rb
s3_multipart-0.0.8 spec/unit/upload_spec.rb
s3_multipart-0.0.7 spec/unit/upload_spec.rb
s3_multipart-0.0.6 spec/unit/upload_spec.rb