Sha256: eb640cdd724af18f4caa61dd8c692ad28d2387ed8ae9f29b581fa5a98e1be045
Contents?: true
Size: 953 Bytes
Versions: 34
Compression:
Stored size: 953 Bytes
Contents
require 'helper' require 'active_support/secure_random' class TestDir < Test::Unit::TestCase include CSD context "When working with directories" do setup do @tmp = Dir.mktmpdir @subdirs = [] 5.times { @subdirs << ActiveSupport::SecureRandom.hex(5) } @subdirs.each { |subdir| ensure_mkdir(File.join(@tmp, subdir)) } end teardown do assert FileUtils.rm_r(@tmp) end context "directories" do should "return all subdirectory names as an array" do result = Dir.directories(@tmp).map { |dirname| dirname } assert_equal @subdirs.sort, result.sort end should "yield all subdirectories in a block" do result = [] Dir.directories(@tmp) { |dir| result << dir } assert_equal @subdirs.sort, Dir.directories(@tmp).sort end end # context "directories" end # context "When working with directories" end
Version data entries
34 entries across 34 versions & 1 rubygems