Created
July 29, 2010 16:23
-
-
Save puyo/498573 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe 'rsync' do | |
it 'should keep the latest version of a file' do | |
system("mkdir -p d1 d2") | |
begin | |
system("echo 'This is the first version' > d1/file.txt") | |
sleep 1 # ensure timestamps are different | |
system("echo 'This is the second version' > d2/file.txt") | |
system("rsync -ru d2/ dest/") | |
system("rsync -ru d1/ dest/") | |
File.read('dest/file.txt').should include('second version') | |
ensure | |
system("rm -rf d1 d2 dest") | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment