Sha256: e472c1ad9385f7b4544230d55d5833552f854468e155ea188e23b320a560fa6a

Contents?: true

Size: 1.08 KB

Versions: 48

Compression:

Stored size: 1.08 KB

Contents

require File.join(File.dirname(__FILE__),'api_helper')

describe "RhosyncApiUploadFile" do
  it_should_behave_like "ApiHelper"
  
  it "should upload and unzip file" do
    file = File.join(File.dirname(__FILE__),'..','testdata','compressed')    
    compress(file)
    zipfile = File.join(file,"compressed.zip")
    post "/api/upload_file", :api_token => @api_token,
      :upload_file => Rack::Test::UploadedFile.new(zipfile, "application/octet-stream")
    FileUtils.rm zipfile
    expected = File.join(Rhosync.app_directory,'compress-data.txt')
    File.exists?(expected).should == true
    File.read(expected).should == 'some compressed text'
    FileUtils.rm expected
  end
  
  it "should fail to upload a non-zip file" do
    file = File.join(File.dirname(__FILE__),'..','testdata','compressed','compress-data.txt')    
    post "/api/upload_file", :api_token => @api_token,
      :upload_file => Rack::Test::UploadedFile.new(file, "application/octet-stream")
    last_response.status.should == 500
    File.exists?(File.join(Rhosync.app_directory,'compress-data.txt')).should == false
  end
end

Version data entries

48 entries across 48 versions & 1 rubygems

Version Path
rhosync-2.1.18.beta2 spec/api/upload_file_spec.rb
rhosync-2.1.18.beta1 spec/api/upload_file_spec.rb
rhosync-2.1.17 spec/api/upload_file_spec.rb
rhosync-2.1.17.beta7 spec/api/upload_file_spec.rb
rhosync-2.1.17.beta6 spec/api/upload_file_spec.rb
rhosync-2.1.17.beta5 spec/api/upload_file_spec.rb
rhosync-2.1.17.beta4 spec/api/upload_file_spec.rb
rhosync-2.1.17.beta3 spec/api/upload_file_spec.rb
rhosync-2.1.17.beta2 spec/api/upload_file_spec.rb
rhosync-2.1.17.beta1 spec/api/upload_file_spec.rb
rhosync-2.1.16 spec/api/upload_file_spec.rb
rhosync-2.1.15 spec/api/upload_file_spec.rb
rhosync-2.1.14 spec/api/upload_file_spec.rb
rhosync-2.1.13 spec/api/upload_file_spec.rb
rhosync-2.1.12 spec/api/upload_file_spec.rb
rhosync-2.1.11 spec/api/upload_file_spec.rb
rhosync-2.1.10 spec/api/upload_file_spec.rb
rhosync-2.1.7 spec/api/upload_file_spec.rb
rhosync-2.1.6 spec/api/upload_file_spec.rb
rhosync-2.1.3 spec/api/upload_file_spec.rb