Permalink
Browse files

Fix incorrect specification path in GemDependency#from_directory_name

Signed-off-by: Michael Koziarski <michael@koziarski.com>
  • Loading branch information...
1 parent cd14a4a commit f43404d42b28c9c4e126829de5f9d815618abe5b @al2o3cr al2o3cr committed with NZKoz Jun 9, 2009
Showing with 8 additions and 1 deletion.
  1. +1 −1 railties/lib/rails/gem_dependency.rb
  2. +7 −0 railties/test/gem_dependency_test.rb
@@ -34,7 +34,7 @@ def self.from_directory_name(directory_name, load_spec=true)
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)
@@ -177,6 +177,13 @@ def test_gem_from_directory_name
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')

0 comments on commit f43404d

Please sign in to comment.