Skip to content

Instantly share code, notes, and snippets.

@puyo
Created July 29, 2010 16:23
Show Gist options
  • Save puyo/498573 to your computer and use it in GitHub Desktop.
Save puyo/498573 to your computer and use it in GitHub Desktop.
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