blob: 9fd249f39cf24f067c6fb8863e3cd96f5646ee6d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
require 'minitest/autorun'
require 'fileutils'
require_relative '../../../lib/dsl'
class RCMDirectoryTest < Minitest::Test
DIR_PATH = './.directory_test.rcmtmp'.freeze
Minitest.after_run do
FileUtils.rm_r(DIR_PATH) if File.directory?(DIR_PATH)
end
def test_create_directory
configure_from_scratch do
directory DIR_PATH do
is present
end
end
assert File.directory?(DIR_PATH)
end
def test_delete_directory
configure_from_scratch do
directory create do
path DIR_PATH
is present
end
directory delete do
path DIR_PATH
is absent
requires directory create
end
end
refute File.directory?(DIR_PATH)
end
def test_purge_directory
configure_from_scratch do
touch create do
path "#{DIR_PATH}/subdir/a_file.txt"
manage directory
end
directory purge do
path DIR_PATH
requires touch create
is purged
without backup
end
end
refute File.directory?(DIR_PATH)
end
end
|