Sha256: 5e097bb17a6649b6bfde28aa5de94db4152ecb752d171c374c26a0c437600544
Contents?: true
Size: 1.84 KB
Versions: 16
Compression:
Stored size: 1.84 KB
Contents
require 'test/unit' require 'veewee' require 'tempfile' class TestVeeweeEnvironment < Test::Unit::TestCase def test_environment_default_to_currentdir # unset the VEEWEE_DIR environment which overwrites cwd ENV['VEEWEE_DIR'] = nil tempdir = Dir.mktmpdir Dir.chdir(tempdir) tempdir=Dir.pwd begin ve=Veewee::Environment.new() assert_equal(ve.cwd,tempdir) ensure FileUtils.remove_entry_secure tempdir end end # If a cwd is passed, it take precendence over currentdir def test_environment_override_environmentdir # Create a temp directory to simulate a currentdir tempdir = Dir.mktmpdir Dir.chdir(tempdir) tempdir=Dir.pwd # Now change to another dir Dir.chdir("/tmp") begin ve=Veewee::Environment.new({:cwd => tempdir}) assert_equal(ve.cwd,tempdir) ensure FileUtils.remove_entry_secure tempdir end end # parent of isodir or definitiondir not writeable should raise an error def test_environment_parentdir_should_be_writeable end # definition_dir , iso_dir by default are relative to the environmentdir def test_environment_iso_dir_relative_to_environmentdir # Create a temp directory to simulate a currentdir tempdir = Dir.mktmpdir Dir.chdir(tempdir) tempdir=Dir.pwd begin ve=Veewee::Environment.new({:cwd => tempdir}) assert_equal(ve.definition_dir,File.join(tempdir,"definitions")) assert_equal(ve.iso_dir,File.join(tempdir,"iso")) ensure FileUtils.remove_entry_secure tempdir end end # definition_dir , iso_dir by default are relative to the environmentdir def test_environment_definition_dir_relative_to_environmentdir # Goto top dir , to make pwd another dir Dir.chdir("/") ve=Veewee::Environment.new({:definition_dir => "/tmp"}) assert_equal(ve.definition_dir,"/tmp") end end
Version data entries
16 entries across 16 versions & 1 rubygems