Sha256: 52049e8bfc128edbdc8928eaaa66e88ebe6e5ecef9c9d1a80b60c48e6edb7eba

Contents?: true

Size: 1.11 KB

Versions: 2

Compression:

Stored size: 1.11 KB

Contents

require 'test/unit'
require 'net/ftp/list'

class TestNetFTPListRumpus < Test::Unit::TestCase

  def setup
    @dir = Net::FTP::List.parse 'drwxrwxrwx               folder        0 Nov 16 22:12 Alias'
    @file = Net::FTP::List.parse '-rw-r--r--        0      101426   101426 Jun  7  2008 imap with spaces.rb'
  end

  def test_parsed
    assert_equal "Rumpus", @dir.server_type, 'LIST Rumpus directory'

    ## TODO: this rumpus file is getting picked up as unix, which if you check
    ##       how it looks above, it looks like unix to me, i dunno how to fix it.
    #assert_equal "Rumpus", @file.server_type, 'LIST Rumpus file with spaces'
  end

  def test_ruby_unix_like_date
    assert_equal Time.parse("Nov 16 22:12"), @dir.mtime
    assert_equal Time.parse("Jun 7 2008"), @file.mtime
  end

  def test_dir
    assert_equal 'Alias', @dir.basename
    assert !@dir.file?
    assert @dir.dir?
  end

  def test_file
    assert_equal 'imap with spaces.rb', @file.basename
    assert @file.file?
    assert !@file.dir?
  end

  def test_filesize
    assert_equal 0, @dir.filesize
    assert_equal 101426, @file.filesize
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
net-ftp-list-3.2.1 test/test_net_ftp_list_rumpus.rb
net-ftp-list-3.2.0 test/test_net_ftp_list_rumpus.rb