Sha256: fdba6bfb81fe50a7610d054504316b19ce9cb6e4b68760228d445263331f4f47

Contents?: true

Size: 1.41 KB

Versions: 19

Compression:

Stored size: 1.41 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' && System.get_property('platform') != 'WINDOWS_DESKTOP'
  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

19 entries across 19 versions & 2 rubygems

Version Path
rhodes-7.6.0 spec/framework_spec/app/spec/library/net/ftp/storbinary_spec.rb
rhodes-7.5.1 spec/framework_spec/app/spec/library/net/ftp/storbinary_spec.rb
rhodes-7.4.1 spec/framework_spec/app/spec/library/net/ftp/storbinary_spec.rb
rhodes-7.1.17 spec/framework_spec/app/spec/library/net/ftp/storbinary_spec.rb
rhodes-6.2.0 spec/framework_spec/app/spec/library/net/ftp/storbinary_spec.rb
rhodes-6.0.11 spec/framework_spec/app/spec/library/net/ftp/storbinary_spec.rb
rhodes-5.5.18 spec/framework_spec/app/spec/library/net/ftp/storbinary_spec.rb
rhodes-5.5.17 spec/framework_spec/app/spec/library/net/ftp/storbinary_spec.rb
rhodes-5.5.15 spec/framework_spec/app/spec/library/net/ftp/storbinary_spec.rb
rhodes-5.5.0.22 spec/framework_spec/app/spec/library/net/ftp/storbinary_spec.rb
rhodes-5.5.2 spec/framework_spec/app/spec/library/net/ftp/storbinary_spec.rb
rhodes-5.5.0.7 spec/framework_spec/app/spec/library/net/ftp/storbinary_spec.rb
rhodes-5.5.0.3 spec/framework_spec/app/spec/library/net/ftp/storbinary_spec.rb
rhodes-5.5.0 spec/framework_spec/app/spec/library/net/ftp/storbinary_spec.rb
tauplatform-1.0.3 spec/framework_spec/app/spec/library/net/ftp/storbinary_spec.rb
tauplatform-1.0.2 spec/framework_spec/app/spec/library/net/ftp/storbinary_spec.rb
tauplatform-1.0.1 spec/framework_spec/app/spec/library/net/ftp/storbinary_spec.rb
rhodes-3.5.1.12 spec/framework_spec/app/spec/library/net/ftp/storbinary_spec.rb
rhodes-3.4.2 spec/framework_spec/app/spec/library/net/ftp/storbinary_spec.rb