1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Fix incorrect specification path in GemDependency#from_directory_name

Signed-off-by: Michael Koziarski <michael@koziarski.com>
This commit is contained in:
Matt Jones 2009-06-09 12:26:52 -04:00 committed by Michael Koziarski
parent 69bc2043f9
commit d7e0cb05cc
2 changed files with 8 additions and 1 deletions

View file

@ -34,7 +34,7 @@ module Rails
name = directory_name_parts[0..-2].join('-')
version = directory_name_parts.last
result = self.new(name, :version => version)
spec_filename = File.join(unpacked_path, directory_name, '.specification')
spec_filename = File.join(directory_name, '.specification')
if load_spec
raise "Missing specification file in #{File.dirname(spec_filename)}. Perhaps you need to do a 'rake gems:refresh_specs'?" unless File.exists?(spec_filename)
spec = YAML::load_file(spec_filename)

View file

@ -178,6 +178,13 @@ class GemDependencyTest < Test::Unit::TestCase
assert_equal '= 1.1', dummy_gem.version_requirements.to_s
end
def test_gem_from_directory_name_loads_specification_successfully
assert_nothing_raised do
dummy_gem = Rails::GemDependency.from_directory_name(File.join(Rails::GemDependency.unpacked_path, 'dummy-gem-g-1.0.0'))
assert_not_nil dummy_gem.specification
end
end
def test_gem_from_invalid_directory_name
assert_raises RuntimeError do
dummy_gem = Rails::GemDependency.from_directory_name('dummy-gem')