Sha256: 4c3509d04f342cbb57790e3d696ab54f68adb5cd46120ca18e511085da463853
Contents?: true
Size: 1.12 KB
Versions: 19
Compression:
Stored size: 1.12 KB
Contents
# -*- coding: utf-8 -*- require 'helper' require 'write_xlsx' class TestDeleteFiles < Minitest::Test def setup @dir_path = 'test_delete_empty_directory' Writexlsx::Utility.delete_files(@dir_path) if FileTest.exist?(@dir_path) end def test_delete_empty_directory Dir.mkdir(@dir_path) assert(FileTest.exist?(@dir_path)) Writexlsx::Utility.delete_files(@dir_path) assert(!FileTest.exist?(@dir_path)) end def test_delete_directory_and_one_file filename = 'test_file' Dir.mkdir(@dir_path) File.open(File.join(@dir_path, filename), "w") { |file| file.write("str") } assert(FileTest.exist?(@dir_path)) assert(FileTest.exist?(File.join(@dir_path, filename))) Writexlsx::Utility.delete_files(@dir_path) assert(!FileTest.exist?(@dir_path)) end def test_delete_directory_and_subdirectory subdir_name = 'subdir' Dir.mkdir(@dir_path) Dir.mkdir(File.join(@dir_path, subdir_name)) assert(FileTest.exist?(@dir_path)) assert(FileTest.exist?(File.join(@dir_path, subdir_name))) Writexlsx::Utility.delete_files(@dir_path) assert(!FileTest.exist?(@dir_path)) end end
Version data entries
19 entries across 19 versions & 1 rubygems