Sha256: 7384312b148750b2332b7e201e24dd18e7a7b6db79bcb0e4e01aae00ab713238

Contents?: true

Size: 1.09 KB

Versions: 2

Compression:

Stored size: 1.09 KB

Contents

require File.expand_path(__FILE__).sub(%r(/test/.*), '/test/test_helper.rb')
require 'scout/path'
require File.expand_path(__FILE__).sub(%r(.*/test/), '').sub(/test_(.*)\.rb/,'\1')
class TestPathFind < Test::Unit::TestCase
  def test_parts
    path = Path.setup("share/data/some_file", 'scout')
    assert_equal "share", path._toplevel
    assert_equal "data/some_file", path._subpath

    path = Path.setup("data", 'scout')
    assert_equal nil, path._toplevel
    assert_equal "data", path._subpath
  end

  def test_find_local
    map = File.join('/usr/local', "{TOPLEVEL}", "{PKGDIR}", "{SUBPATH}")
    path = Path.setup("share/data/some_file", 'scout')
    target = "/usr/local/share/scout/data/some_file"
    assert_equal target, Path.follow(path, map)
  end

  def test_find
    path = Path.setup("share/data/some_file", 'scout')
    assert_equal "/usr/share/scout/data/some_file", path.find(:usr)
  end

  def test_current
    path = Path.setup("share/data/some_file", 'scout')
    TmpFile.in_dir do |tmpdir|
      assert_equal File.join(tmpdir,"share/data/some_file"),  path.find(:current)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
scout-gear-1.1.1 test/scout/path/test_find.rb
scout-gear-1.1.0 test/scout/path/test_find.rb