spec/functional/server_spec.rb in fake_ftp-0.1.1 vs spec/functional/server_spec.rb in fake_ftp-0.2.0

- old
+ new

@@ -315,14 +315,30 @@ server.add_file('another_file', '1234567890') client.puts "NLST" expect(client.gets).to eql("150 Listing status ok, about to open data connection\r\n") data = data_client.read(1024) data_client.close - expect(data).to eql("some_file\nanother_file") + expect(data).to eql("some_file\nanother_file\n") expect(client.gets).to eql("226 List information transferred\r\n") end + it "accepts an NLST command with wildcard arguments" do + files = ['test.jpg', 'test.txt', 'test2.jpg'] + files.each do |file| + server.add_file(file, '1234567890') + end + + client.puts "NLST *.jpg" + + expect(client.gets).to eql("150 Listing status ok, about to open data connection\r\n") + data = data_client.read(1024) + data_client.close + + expect(data).to eql("test.jpg\ntest2.jpg\n") + expect(client.gets).to eql("226 List information transferred\r\n") + end + it "should allow mdtm" do filename = "file.txt" now = Time.now server.add_file(filename, "some dummy content", now) client.puts "MDTM #{filename}" @@ -457,10 +473,10 @@ @data_connection.join data = @server_client.read(1024) @server_client.close - expect(data).to eql("some_file\nanother_file") + expect(data).to eql("some_file\nanother_file\n") expect(client.gets).to eql("226 List information transferred\r\n") end end end end