aboutsummaryrefslogtreecommitdiff
path: root/vendor/supply_drop/test/rsync_test.rb
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2012-10-23 03:50:52 -0700
committerelijah <elijah@riseup.net>2012-10-23 03:50:52 -0700
commitd385da49ef6c17c64cf8be66002f5744c1ee38f7 (patch)
tree6e19772d6adf2b302e73dbd9229eb3618d19bab0 /vendor/supply_drop/test/rsync_test.rb
parent3a27d87e6a28e4b58842ca4cb7a1ddc4e6637b36 (diff)
downloadleap_cli-d385da49ef6c17c64cf8be66002f5744c1ee38f7.tar.gz
leap_cli-d385da49ef6c17c64cf8be66002f5744c1ee38f7.tar.bz2
patched supply_drop gem and vendored it
Diffstat (limited to 'vendor/supply_drop/test/rsync_test.rb')
-rw-r--r--vendor/supply_drop/test/rsync_test.rb57
1 files changed, 57 insertions, 0 deletions
diff --git a/vendor/supply_drop/test/rsync_test.rb b/vendor/supply_drop/test/rsync_test.rb
new file mode 100644
index 0000000..b51a6b3
--- /dev/null
+++ b/vendor/supply_drop/test/rsync_test.rb
@@ -0,0 +1,57 @@
+require 'test/unit'
+require File.expand_path('../../lib/supply_drop/rsync', __FILE__)
+
+class RsyncTest < Test::Unit::TestCase
+
+ def test_build_simple_command
+ command = SupplyDrop::Rsync.command('bar', 'foo')
+ assert_equal 'rsync -az bar foo', command
+ end
+
+ def test_allows_passing_delete
+ command = SupplyDrop::Rsync.command('bar', 'foo', :delete => true)
+ assert_equal 'rsync -az --delete bar foo', command
+ end
+
+ def test_allows_specifying_an_exclude
+ command = SupplyDrop::Rsync.command('bar', 'foo', :excludes => '.git')
+ assert_equal 'rsync -az --exclude=.git bar foo', command
+ end
+
+ def test_ssh_options_keys_only_lists_existing_files
+ command = SupplyDrop::Rsync.command('.', 'foo', :ssh => { :keys => [__FILE__, "#{__FILE__}dadijofs"] })
+ assert_match /-i #{__FILE__}/, command
+ end
+
+ def test_ssh_options_ignores_keys_if_nil
+ command = SupplyDrop::Rsync.command('.', 'foo', :ssh => { :keys => nil })
+ assert_equal 'rsync -az . foo', command
+ command = SupplyDrop::Rsync.command('bar', 'foo')
+ assert_equal 'rsync -az bar foo', command
+ end
+
+ def test_ssh_options_config_adds_flag
+ command = SupplyDrop::Rsync.command('.', 'foo', :ssh => { :config => __FILE__ })
+ assert_equal %Q[rsync -az -e "ssh -F #{__FILE__}" . foo], command
+ end
+
+ def test_ssh_options_port_adds_port
+ command = SupplyDrop::Rsync.command('.', 'foo', :ssh => { :port => '30022' })
+ assert_equal %Q[rsync -az -e "ssh -p 30022" . foo], command
+ end
+
+ def test_ssh_options_ignores_config_if_nil_or_false
+ command = SupplyDrop::Rsync.command('.', 'foo', :ssh => { :config => nil })
+ assert_equal 'rsync -az . foo', command
+ command = SupplyDrop::Rsync.command('.', 'foo', :ssh => { :config => false })
+ assert_equal 'rsync -az . foo', command
+ end
+
+ def test_remote_address_concatinates_things_correctly
+ assert_equal "user@box.local:/tmp", SupplyDrop::Rsync.remote_address('user', 'box.local', '/tmp')
+ end
+
+ def test_remote_address_drops_at_when_user_is_nil
+ assert_equal 'box.local:/tmp', SupplyDrop::Rsync.remote_address(nil, 'box.local', '/tmp')
+ end
+end