Sha256: c392d08b6a40dd56c57fc9763f6e2d30b623c5f3f0576ef5e248d2f6f5283a80

Contents?: true

Size: 1.76 KB

Versions: 15

Compression:

Stored size: 1.76 KB

Contents

require 'test/unit'
require 'veewee'
require 'tempfile'

class TestVeeweeEnvironment < Test::Unit::TestCase
  def test_environment_default_to_currentdir

    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

15 entries across 15 versions & 2 rubygems

Version Path
veewee-atlassian-0.3.11 test/environment_test.rb
veewee-0.3.7 test/environment_test.rb
veewee-0.3.6 test/environment_test.rb
veewee-0.3.5 test/environment_test.rb
veewee-0.3.4 test/environment_test.rb
veewee-0.3.3 test/environment_test.rb
veewee-0.3.2 test/environment_test.rb
veewee-0.3.1 test/environment_test.rb
veewee-0.3.0.beta2 test/environment_test.rb
veewee-0.3.0.beta1 test/environment_test.rb
veewee-0.3.0.alpha9 test/environment_test.rb
veewee-0.3.0.alpha8 test/environment_test.rb
veewee-0.3.0.alpha7 test/environment_test.rb
veewee-0.3.0.alpha6 test/environment_test.rb
veewee-0.3.0.alpha5 test/environment_test.rb