Sha256: 7d4a130f239e2c7fb55f1adbdeafce32f2f0642511a977a9388c4675889db0de
Contents?: true
Size: 1.33 KB
Versions: 2
Compression:
Stored size: 1.33 KB
Contents
require File.expand_path(__FILE__).sub(%r(/test/.*), '/test/test_helper.rb') require File.expand_path(__FILE__).sub(%r(.*/test/), '').sub(/test_(.*)\.rb/,'\1') class TestPath < Test::Unit::TestCase def test_join path = '/tmp' path.extend Path assert_equal '/tmp/foo', path.join(:foo) assert_equal '/tmp/foo/bar', path.join(:bar, :foo) end def test_get path = '/tmp' path.extend Path assert_equal '/tmp/foo', path[:foo] assert_equal '/tmp/foo/bar', path.foo[:bar] assert_equal '/tmp/foo/bar', path[:bar, :foo] end def test_slash path = '/tmp' path.extend Path assert_equal '/tmp/foo', path/:foo assert_equal '/tmp/foo/bar', path/:foo/:bar assert_equal '/tmp/foo/bar', path.foo/:bar assert_equal '/tmp/foo/bar', path./(:bar, :foo) end def test_setup path = 'tmp' Path.setup(path) assert_equal 'scout', path.pkgdir assert path.libdir.end_with?("scout-gear") end def test_lib_dir TmpFile.with_file do |tmpdir| Path.setup tmpdir FileUtils.mkdir_p tmpdir.lib File.write tmpdir.lib.file, <<-EOR require '#{File.expand_path(__FILE__).sub(%r(.*/test/), '').sub(/test_(.*)\.rb/,'\1')}' a = "1" Path.setup(a) print a.libdir EOR Misc.in_dir tmpdir.tmp do assert_equal tmpdir, `ruby #{tmpdir.lib.file}` end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
scout-gear-2.0.0 | test/scout/test_path.rb |
scout-gear-1.2.0 | test/scout/test_path.rb |