Sha256: 0e2d030f63371ae8b134b31ae7397221e6e96231b97773e3eabbe854d6a22238

Contents?: true

Size: 1.12 KB

Versions: 1

Compression:

Stored size: 1.12 KB

Contents

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

class TestNetFTPListNetware < Test::Unit::TestCase

  def setup
    @dir  = Net::FTP::List.parse('d [RWCEAFMS] dpearce                          512 Jun 27 23:46 public.www')
    @file = Net::FTP::List.parse('- [RWCEAFMS] dpearce                         2767 Jun 22 06:22 about.html')
  end

  def test_parse_new
    assert_instance_of Net::FTP::List::Netware, @dir, 'LIST Netware directory'
    assert_instance_of Net::FTP::List::Netware, @file, 'LIST Netware file'
  end

  def test_rubbish_lines
    assert_instance_of Net::FTP::List::Unknown, Net::FTP::List.parse("++ bah! ++")
  end

  def test_ruby_netware_mtime
    assert_equal @dir.mtime, Time.parse('Jun 27 23:46')
    assert_equal @file.mtime, Time.parse('Jun 22 06:22')
  end

  def test_ruby_netware_like_dir
    assert_equal 'public.www', @dir.basename
    assert @dir.dir?
    assert !@dir.file?
  end

  def test_ruby_netware_like_file
    assert_equal 'about.html', @file.basename
    assert @file.file?
    assert !@file.dir?
  end

  def test_filesize
    assert_equal 512, @dir.filesize
    assert_equal 2767, @file.filesize
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
net-ftp-list-2.1.1 test/test_net_ftp_list_netware.rb