1require_relative '../../../spec_helper' 2require_relative 'spec_helper' 3require_relative 'fixtures/server' 4 5describe "Net::FTP#retrlines" do 6 before :each do 7 @server = NetFTPSpecs::DummyFTP.new 8 @server.serve_once 9 10 @ftp = Net::FTP.new 11 @ftp.connect(@server.hostname, @server.server_port) 12 end 13 14 after :each do 15 @ftp.quit rescue nil 16 @ftp.close 17 @server.stop 18 end 19 20 it "sends the passed command over the socket" do 21 @ftp.retrlines("LIST test.dir") {} 22 @ftp.last_response.should == "226 transfer complete (LIST test.dir)\n" 23 end 24 25 it "yields each received line to the passed block" do 26 res = [] 27 @ftp.retrlines("LIST test.dir") { |x| res << x } 28 res.should == [ 29 "-rw-r--r-- 1 spec staff 507 17 Jul 18:41 last_response_code.rb", 30 "-rw-r--r-- 1 spec staff 50 17 Jul 18:41 list.rb", 31 "-rw-r--r-- 1 spec staff 48 17 Jul 18:41 pwd.rb" 32 ] 33 end 34end 35