summaryrefslogtreecommitdiff
path: root/test/lib
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2025-02-18 12:48:10 +0200
committerPaul Buetow <paul@buetow.org>2025-02-18 12:48:10 +0200
commit2ea74a7ce93bc4759243cb6054b8d70a73e5716a (patch)
tree1af01270a9317221e076870dcffee6cc65901d35 /test/lib
parent2327c02594db5b50b2b59bcc5e731c5723f5423b (diff)
testing backup
Diffstat (limited to 'test/lib')
-rw-r--r--test/lib/dslkeywords/file_test.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/lib/dslkeywords/file_test.rb b/test/lib/dslkeywords/file_test.rb
index d0afd92..1a636b8 100644
--- a/test/lib/dslkeywords/file_test.rb
+++ b/test/lib/dslkeywords/file_test.rb
@@ -68,4 +68,28 @@ class RCMFileTest < Minitest::Test
assert File.exist?(file_path)
assert_equal :content, File.read(file_path).to_sym
end
+
+ def test_backup
+ file_path = "#{DIR_PATH}/foo/backup-me.txt"
+ original_content = 'original_content'
+ backup_path = "#{DIR_PATH}/foo/.rcm/backup-me.txt.d4c3af73588ce06c32ed04d1b79801286109ea265712a2bd3fdc3ed01c82bb86"
+
+ configure_from_scratch do
+ file :original do
+ path file_path
+ create_parent_directory
+ original_content
+ end
+
+ file :new do
+ path file_path
+ create_parent_directory
+ depends_on file(:original)
+ :new_content
+ end
+ end
+
+ assert File.file?(backup_path)
+ assert_equal original_content, File.read(backup_path)
+ end
end