Sha256: 8b8b6946f198df8befe58f2cb1db317f3bd0baf2083a00a764ba3ad53fe2d9e6

Contents?: true

Size: 1.23 KB

Versions: 13

Compression:

Stored size: 1.23 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

  Win32 = Rake::Win32
  
  def test_win32_system_dir_uses_appdata_if_defined
    in_environment('RAKE_SYSTEM' => nil, 'APPDATA' => '\\AD') do
      assert_equal "/AD/Rake", Win32.win32_system_dir 
    end
  end

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

  def test_win32_system_dir_uses_userprofile_otherwise
    in_environment(
      'RAKE_SYSTEM' => nil,
      'APPDATA' => nil,
      'HOMEDRIVE' => nil,
      "HOMEPATH" => nil,
      "USERPROFILE" => '\\UP'
      ) do
      assert_equal "/UP/Rake", Win32.win32_system_dir
    end
  end

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

end

Version data entries

13 entries across 13 versions & 5 rubygems

Version Path
elliottcable-echoe-3.1.1 vendor/rake/test/test_win32.rb
elliottcable-echoe-3.1.2 vendor/rake/test/test_win32.rb
jimweirich-rake-0.8.2.99 test/test_win32.rb
jimweirich-rake-0.8.3.1 test/test_win32.rb
jimweirich-rake-0.8.3 test/test_win32.rb
merb-core-1.1.3 spec10/public/webrat/test_app/gems/gems/rake-0.8.3/test/test_win32.rb
merb-core-1.1.2 spec10/public/webrat/test_app/gems/gems/rake-0.8.3/test/test_win32.rb
merb-core-1.1.1 spec10/public/webrat/test_app/gems/gems/rake-0.8.3/test/test_win32.rb
merb-core-1.1.0 spec10/public/webrat/test_app/gems/gems/rake-0.8.3/test/test_win32.rb
merb-core-1.1.0.rc1 spec10/public/webrat/test_app/gems/gems/rake-0.8.3/test/test_win32.rb
merb-core-1.1.0.pre spec10/public/webrat/test_app/gems/gems/rake-0.8.3/test/test_win32.rb
drake-0.8.3.1.0.14 test/test_win32.rb
rake-0.8.3 test/test_win32.rb