Merge pull request #763 from pivotal-casebook/relative_home_path
Fix for Compass.shared_extension_paths when HOME is a relative path or some other stupid value.
This commit is contained in:
commit
1d78bfd7cc
@ -21,6 +21,8 @@ module Compass
|
|||||||
else
|
else
|
||||||
[]
|
[]
|
||||||
end
|
end
|
||||||
|
rescue ArgumentError # If HOME is relative
|
||||||
|
[]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
module_function :base_directory, :lib_directory, :shared_extension_paths
|
module_function :base_directory, :lib_directory, :shared_extension_paths
|
||||||
|
36
test/units/compass_module_test.rb
Normal file
36
test/units/compass_module_test.rb
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
require File.join(File.dirname(__FILE__), "..", "test_helper")
|
||||||
|
|
||||||
|
class CompassModuleTest < Test::Unit::TestCase
|
||||||
|
|
||||||
|
def setup
|
||||||
|
Compass.reset_configuration!
|
||||||
|
Compass.instance_variable_set("@shared_extension_paths", nil)
|
||||||
|
@original_home = ENV["HOME"]
|
||||||
|
end
|
||||||
|
|
||||||
|
def teardown
|
||||||
|
ENV["HOME"] = @original_home
|
||||||
|
Compass.reset_configuration!
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_shared_extension_paths_with_valid_home
|
||||||
|
ENV["HOME"] = "/"
|
||||||
|
assert_equal ["/.compass/extensions"], Compass.shared_extension_paths
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_shared_extension_paths_with_nil_home
|
||||||
|
ENV["HOME"] = nil
|
||||||
|
assert_equal [], Compass.shared_extension_paths
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_shared_extension_paths_with_file_home
|
||||||
|
ENV["HOME"] = __FILE__
|
||||||
|
assert_equal [], Compass.shared_extension_paths
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_shared_extension_paths_with_relative_home
|
||||||
|
ENV["HOME"] = "."
|
||||||
|
assert_equal [], Compass.shared_extension_paths
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
Loading…
Reference in New Issue
Block a user