Sha256: f05bd6c2b0cf48bb6a454a210c638cdd977cd2026e8c7379d812ea808fa6d495

Contents?: true

Size: 1.65 KB

Versions: 208

Compression:

Stored size: 1.65 KB

Contents

require File.expand_path('../helper', __FILE__)
require 'date'
require 'time'
require 'rake/contrib/ftptools'

class FakeDate
  def self.today
    Date.new(2003,10,3)
  end
  def self.now
    Time.local(2003,10,3,12,00,00)
  end
end

class TestRakeFtpFile < Rake::TestCase

  def setup
    super

    Rake::FtpFile.class_eval { @date_class = FakeDate; @time_class = FakeDate }
  end

  def test_general
    file = Rake::FtpFile.new("here", "-rw-r--r--   1 a279376  develop   121770 Mar  6 14:50 wiki.pl")
    assert_equal "wiki.pl", file.name
    assert_equal "here/wiki.pl", file.path
    assert_equal "a279376", file.owner
    assert_equal "develop", file.group
    assert_equal 0644, file.mode
    assert_equal 121770, file.size
    assert_equal Time.mktime(2003,3,6,14,50,0,0), file.time
    assert ! file.directory?
    assert ! file.symlink?
  end

  def test_far_date
    file = Rake::FtpFile.new(".", "drwxr-xr-x   3 a279376  develop     4096 Nov 26  2001 vss")
    assert_equal Time.mktime(2001,11,26,0,0,0,0), file.time
  end

  def test_close_date
    file = Rake::FtpFile.new(".", "drwxr-xr-x   3 a279376  develop     4096 Nov 26 15:35 vss")
    assert_equal Time.mktime(2002,11,26,15,35,0,0), file.time
  end

  def test_directory
    file = Rake::FtpFile.new(".", "drwxrwxr-x   9 a279376  develop     4096 Mar 13 14:32 working")
    assert file.directory?
    assert !file.symlink?
  end

  def test_symlink
    file = Rake::FtpFile.new(".", "lrwxrwxrwx   1 a279376  develop       64 Mar 26  2002 xtrac -> /home/a279376/working/ics/development/java/com/fmr/fwp/ics/xtrac")
    assert_equal 'xtrac', file.name
    assert file.symlink?
    assert !file.directory?
  end
end

Version data entries

208 entries across 162 versions & 43 rubygems

Version Path
rubyjobbuilderdsl-0.0.2 vendor/bundle/ruby/2.1.0/gems/rake-0.9.6/test/test_rake_ftp_file.rb
rubyjobbuilderdsl-0.0.1 vendor/bundle/ruby/2.1.0/gems/rake-0.9.6/test/test_rake_ftp_file.rb
active_mailer-0.0.10 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/rake-10.0.3/test/test_rake_ftp_file.rb
judge-2.0.5 vendor/bundle/ruby/2.1.0/gems/rake-10.0.3/test/test_rake_ftp_file.rb
gss-0.0.7 vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/test/test_rake_ftp_file.rb
gss-0.0.6 vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/test/test_rake_ftp_file.rb
gss-0.0.5 vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/test/test_rake_ftp_file.rb
candlepin-api-0.4.0 bundle/ruby/1.9.1/gems/rake-0.9.2.2/test/test_rake_ftp_file.rb
candlepin-api-0.4.0 bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_ftp_file.rb
candlepin-api-0.4.0 bundle/ruby/gems/rake-0.9.2.2/test/test_rake_ftp_file.rb
torquebox-console-0.3.0 vendor/bundle/jruby/1.9/gems/rake-10.0.3/test/test_rake_ftp_file.rb
swipe-rails-0.0.5 vendor/bundle/gems/rake-10.0.4/test/test_rake_ftp_file.rb
active_mailer-0.0.9 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/rake-10.0.3/test/test_rake_ftp_file.rb
active_mailer-0.0.8 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/rake-10.0.3/test/test_rake_ftp_file.rb
active_mailer-0.0.7 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/rake-10.0.3/test/test_rake_ftp_file.rb
sshp-0.0.2 vendor/ruby/1.9.1/gems/rake-10.0.4/test/test_rake_ftp_file.rb
sshp-0.0.1 vendor/ruby/1.9.1/gems/rake-10.0.4/test/test_rake_ftp_file.rb
active_mailer-0.0.6 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/rake-10.0.3/test/test_rake_ftp_file.rb
vergissberlin-0.0.9 vendor/bundle/gems/rake-10.0.4/test/test_rake_ftp_file.rb
vergissberlin-0.0.7 vendor/bundle/gems/rake-10.0.4/test/test_rake_ftp_file.rb