Sha256: 20c8697cf1ef6f291b2f394e9f00020ce639583a10f91962a0d3776dcb599fc1

Contents?: true

Size: 866 Bytes

Versions: 2

Compression:

Stored size: 866 Bytes

Contents

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

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

    @ftp = Net::FTP.new
    @ftp.connect("localhost", 9921)
  end

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

  it "sends the passed command over the socket" do
    @ftp.retrlines("LIST test.dir") {}
    @ftp.last_response.should == "226 transfer complete (LIST test.dir)\n"
  end

  it "yields each received line to the passed block" do
    res = []
    @ftp.retrlines("LIST test.dir") { |x| res << x }
    res.should == [
      "-rw-r--r--  1 spec  staff  507 17 Jul 18:41 last_response_code.rb",
      "-rw-r--r--  1 spec  staff   50 17 Jul 18:41 list.rb",
      "-rw-r--r--  1 spec  staff   48 17 Jul 18:41 pwd.rb"
    ]
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rubysl-net-ftp-2.0.1 spec/retrlines_spec.rb
rubysl-net-ftp-1.0.0 spec/retrlines_spec.rb