Sha256: 27ebff6b5dd83d7d35e6c7ed65d15bd17696c384698a92eb2371959282ae5198

Contents?: true

Size: 1.01 KB

Versions: 4

Compression:

Stored size: 1.01 KB

Contents

require File.expand_path('../helper', __FILE__)

class BackupFileItemTest < Test::Unit::TestCase
  def setup
    @file_item = Backup::FileItem.for :local
  end
  
  def test_semantic_path
    assert_equal __FILE__, @file_item.semantic_path(__FILE__)
    assert_equal File.dirname(__FILE__) + '/',
                 @file_item.semantic_path(File.dirname(__FILE__))
  end

  def test_file_stat
    file = @file_item.stat(
      __FILE__,
      Backup::Timestamp.create
    )
    key = file.keys.first

    assert_not_nil file[key][:uid]
    assert_not_nil file[key][:gid]
    assert_not_nil file[key][:mode]
    assert_not_nil file[key][:checksum]
    assert_not_nil file[key][:timestamp]
  end

  def test_directory_stat
    file = @file_item.stat(
      File.dirname(__FILE__),
      Backup::Timestamp.create
    )
    key = file.keys.first

    assert_not_nil file[key][:uid]
    assert_not_nil file[key][:gid]
    assert_not_nil file[key][:mode]
    assert_nil file[key][:checksum]
    assert_not_nil file[key][:timestamp]
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
encbs-0.1.3 test/test_backup_file_item.rb
encbs-0.1.2 test/test_backup_file_item.rb
encbs-0.1.1 test/test_backup_file_item.rb
encbs-0.1.0 test/test_backup_file_item.rb