Sha256: ea2d17b0722af39a6f66a065144432b45efab42a60c4e6f5b0f4145a495c82b5

Contents?: true

Size: 1.36 KB

Versions: 30

Compression:

Stored size: 1.36 KB

Contents

require File.expand_path('../../../../spec_helper', __FILE__)
require 'net/ftp'
require File.expand_path('../fixtures/server', __FILE__)

describe "Net::FTP#storbinary" do
  before(:each) do
    @server = NetFTPSpecs::DummyFTP.new
    @server.serve_once

    @local_fixture_file = File.join(Rho::RhoApplication::get_model_path('app','spec'), 'library/net/ftp/fixtures/putbinaryfile') #File.dirname(__FILE__) + "/fixtures/putbinaryfile"
    @tmp_file = tmp("binaryfile", false)

    @ftp = Net::FTP.new
    @ftp.connect("127.0.0.1", 9876)
  end

  after(:each) do
    @ftp.quit rescue nil
    @ftp.close
    @server.stop

    rm_r @tmp_file
  end
if System::get_property('platform') != 'WINDOWS'
  it "sends the passed command and the passed File object's content to the server" do
    File.open(@local_fixture_file) do |f|
      f.binmode

      @ftp.storbinary("STOR binary", f, 4096) {}
      @ftp.last_response.should == "200 OK, Data received. (STOR binary)\n"
    end
  end

  it "yields the transmitted content as binary blocks of the passed size" do
    File.open(@local_fixture_file) do |f|
      f.binmode

      res = []
      @ftp.storbinary("STOR binary", f, 10) { |x| res << x }
      res.should == [
        "This is an", " example f",
        "ile\nwhich ", "is going t",
        "o be trans", "mitted\nusi",
        "ng #putbin", "aryfile."
      ]
    end
  end
end  
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
rhodes-3.3.5 spec/framework_spec/app/spec/library/net/ftp/storbinary_spec.rb
rhodes-3.3.4 spec/framework_spec/app/spec/library/net/ftp/storbinary_spec.rb
rhodes-3.3.3 spec/framework_spec/app/spec/library/net/ftp/storbinary_spec.rb
rhodes-3.3.3.beta.4 spec/framework_spec/app/spec/library/net/ftp/storbinary_spec.rb
rhodes-3.3.3.beta.3 spec/framework_spec/app/spec/library/net/ftp/storbinary_spec.rb
rhodes-3.3.3.beta.2 spec/framework_spec/app/spec/library/net/ftp/storbinary_spec.rb
rhodes-3.3.3.beta.1 spec/framework_spec/app/spec/library/net/ftp/storbinary_spec.rb
rhodes-3.3.2 spec/framework_spec/app/spec/library/net/ftp/storbinary_spec.rb
rhodes-3.3.2.beta.7 spec/framework_spec/app/spec/library/net/ftp/storbinary_spec.rb
rhodes-3.3.2.beta.6 spec/framework_spec/app/spec/library/net/ftp/storbinary_spec.rb
rhodes-3.3.2.beta.5 spec/framework_spec/app/spec/library/net/ftp/storbinary_spec.rb
rhodes-3.3.2.beta.4 spec/framework_spec/app/spec/library/net/ftp/storbinary_spec.rb
rhodes-3.3.2.beta.3 spec/framework_spec/app/spec/library/net/ftp/storbinary_spec.rb
rhodes-3.3.2.beta.2 spec/framework_spec/app/spec/library/net/ftp/storbinary_spec.rb
rhodes-3.3.2.beta.1 spec/framework_spec/app/spec/library/net/ftp/storbinary_spec.rb
rhodes-3.3.1 spec/framework_spec/app/spec/library/net/ftp/storbinary_spec.rb
rhodes-3.3.0 spec/framework_spec/app/spec/library/net/ftp/storbinary_spec.rb
rhodes-3.3.0.beta.3 spec/framework_spec/app/spec/library/net/ftp/storbinary_spec.rb
rhodes-3.3.0.beta.2 spec/framework_spec/app/spec/library/net/ftp/storbinary_spec.rb
rhodes-3.3.0.beta.1 spec/framework_spec/app/spec/library/net/ftp/storbinary_spec.rb