Sha256: c49af14684e034f8e411b2c890890aa9307643f3a7bf97704d9db750c436e9ca
Contents?: true
Size: 1.79 KB
Versions: 4
Compression:
Stored size: 1.79 KB
Contents
require File.dirname(__FILE__) + '/test_helper' class UtilTest < Test::Unit::TestCase include def setup @path = "/tmp/astrovan.#{Time.now.to_i}" super end def teardown system "rm -rf #{@path} #{@path}.lnk" super end def test_should_mkdir assert !File.exist?(@path) using 'astrovan.local', :password => ENV['PASSWORD'], :path => @path do mkdir path end assert File.exist?(@path) assert File.directory?(@path) end def test_should_rm_file create_file using 'astrovan.local', :password => ENV['PASSWORD'], :path => @path do rm path end assert !File.exist?(@path) end def test_should_not_rm_directory system "mkdir -p #{@path}" assert File.exist?(@path) assert File.directory?(@path) assert_raise(RuntimeError) do using 'astrovan.local', :password => ENV['PASSWORD'], :path => @path do rm path end end assert File.exist?(@path) assert File.directory?(@path) end def test_should_rm_directory_with_recursive_option system "mkdir -p #{@path}" assert File.exist?(@path) assert File.directory?(@path) using 'astrovan.local', :password => ENV['PASSWORD'], :path => @path do rm path, :recursive => true end assert !File.exist?(@path) end def test_should_symlink data = create_file target = @path + ".lnk" using 'astrovan.local', :password => ENV['PASSWORD'], :path => @path, :target => target do symlink path, :to => target end assert File.exist?(target) assert File.symlink?(target) assert_equal data, File.open(target) { |f| f.gets.chomp } end protected def create_file data = Time.now.utc.to_s File.open(@path,'w') { |f| f.puts data } assert File.exist?(@path) assert !File.directory?(@path) data end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
sbfaulkner-astrovan-0.5.2 | test/util_test.rb |
sbfaulkner-astrovan-0.5.3 | test/util_test.rb |
sbfaulkner-astrovan-0.5.4 | test/util_test.rb |
sbfaulkner-astrovan-0.5.6 | test/util_test.rb |