/vendor/gems/facets-2.4.5/test/core/dir/test_descend.rb
Ruby | 25 lines | 20 code | 5 blank | 0 comment | 0 complexity | 11d7ac3c9757c3de0342c985f0e916f3 MD5 | raw file
Possible License(s): GPL-3.0, GPL-2.0, IPL-1.0, AGPL-1.0, LGPL-3.0
- require 'facets/dir/ascend'
- require 'test/unit'
- require 'tmpdir'
- class TC_Dir_Descend < Test::Unit::TestCase
- def setup
- @location = File.join(Dir.tmpdir, self.class.name, Time.now.usec.to_s)
- @startdir = File.join(@location)
- end
- def test_descend
- c = []
- Dir.descend(@startdir) do |path|
- c << path
- end
- rdir = @startdir
- c.reverse_each do |d|
- assert_equal(rdir, d)
- rdir = File.dirname(rdir)
- end
- end
- end