Sha256: ab7fbeee0faeddbd76528d97fbc73a4082c9d4f639d6e4b8121b17b14682dd2a

Contents?: true

Size: 1.74 KB

Versions: 95

Compression:

Stored size: 1.74 KB

Contents

#!/usr/bin/env ruby

require 'test/unit'
require 'test/rake_test_setup'
require 'test/in_environment'

require 'rake'

class TestWin32 < Test::Unit::TestCase
  include InEnvironment
  include TestMethods

  Win32 = Rake::Win32

  def test_win32_system_dir_uses_home_if_defined
    in_environment('RAKE_SYSTEM' => nil, 'HOME' => 'C:\\HP') do
      assert_equal "C:/HP/Rake", Win32.win32_system_dir
    end
  end

  def test_win32_system_dir_uses_homedrive_homepath_when_no_home_defined
    in_environment(
      'RAKE_SYSTEM' => nil,
      'HOME' => nil,
      'HOMEDRIVE' => "C:",
      'HOMEPATH' => "\\HP"
      ) do
      assert_equal "C:/HP/Rake", Win32.win32_system_dir
    end
  end

  def test_win32_system_dir_uses_appdata_when_no_home_or_home_combo
    in_environment(
      'RAKE_SYSTEM' => nil,
      'HOME' => nil,
      'HOMEDRIVE' => nil,
      'HOMEPATH' => nil,
      'APPDATA' => "C:\\Documents and Settings\\HP\\Application Data"
      ) do
      assert_equal "C:/Documents and Settings/HP/Application Data/Rake", Win32.win32_system_dir
    end
  end

  def test_win32_system_dir_fallback_to_userprofile_otherwise
    in_environment(
      'RAKE_SYSTEM' => nil,
      'HOME' => nil,
      'HOMEDRIVE' => nil,
      'HOMEPATH' => nil,
      'APPDATA' => nil,
      'USERPROFILE' => "C:\\Documents and Settings\\HP"
      ) do
      assert_equal "C:/Documents and Settings/HP/Rake", Win32.win32_system_dir
    end
  end

  def test_win32_system_dir_nil_of_no_env_vars
    in_environment(
      'RAKE_SYSTEM' => nil,
      'HOME' => nil,
      'HOMEDRIVE' => nil,
      "HOMEPATH" => nil,
      'APPDATA' => nil,
      "USERPROFILE" => nil
      ) do
      assert_exception(Rake::Win32::Win32HomeError) do
        Win32.win32_system_dir
      end
    end
  end

end

Version data entries

95 entries across 67 versions & 9 rubygems

Version Path
middleman-0.10.15 vendor/gems/gems/rake-0.8.7/test/test_win32.rb
middleman-0.10.14 vendor/gems/gems/rake-0.8.7/test/test_win32.rb
drake-0.8.4.1.0.17 test/test_win32.rb
drake-0.8.4.1.0.16 test/test_win32.rb
drake-0.8.4.1.0.15 test/test_win32.rb
drake-0.8.4.1.2.0 test/test_win32.rb
drake-0.8.7.0.2.3 test/test_win32.rb
drake-0.8.5.0.2.2 test/test_win32.rb
drake-0.8.4.1.2.1 test/test_win32.rb
drake-0.8.4.1.0.18 test/test_win32.rb
drake-0.8.4.1.1.0 test/test_win32.rb
rake-0.8.4 test/test_win32.rb
rake-0.8.5 test/test_win32.rb
rake-0.8.6 test/test_win32.rb
rake-0.8.7 test/test_win32.rb