Skip to content
This repository
Browse code

Fix incorrect specification path in GemDependency#from_directory_name

Signed-off-by: Michael Koziarski <michael@koziarski.com>
  • Loading branch information...
commit f43404d42b28c9c4e126829de5f9d815618abe5b 1 parent cd14a4a
Matt Jones authored June 09, 2009 NZKoz committed June 10, 2009
2  railties/lib/rails/gem_dependency.rb
@@ -34,7 +34,7 @@ def self.from_directory_name(directory_name, load_spec=true)
34 34
       name    = directory_name_parts[0..-2].join('-')
35 35
       version = directory_name_parts.last
36 36
       result = self.new(name, :version => version)
37  
-      spec_filename = File.join(unpacked_path, directory_name, '.specification')
  37
+      spec_filename = File.join(directory_name, '.specification')
38 38
       if load_spec
39 39
         raise "Missing specification file in #{File.dirname(spec_filename)}. Perhaps you need to do a 'rake gems:refresh_specs'?" unless File.exists?(spec_filename)
40 40
         spec = YAML::load_file(spec_filename)
7  railties/test/gem_dependency_test.rb
@@ -177,6 +177,13 @@ def test_gem_from_directory_name
177 177
     assert_equal '= 1.1',     dummy_gem.version_requirements.to_s
178 178
   end
179 179
 
  180
+  def test_gem_from_directory_name_loads_specification_successfully
  181
+    assert_nothing_raised do
  182
+      dummy_gem = Rails::GemDependency.from_directory_name(File.join(Rails::GemDependency.unpacked_path, 'dummy-gem-g-1.0.0'))
  183
+      assert_not_nil dummy_gem.specification
  184
+    end
  185
+  end
  186
+
180 187
   def test_gem_from_invalid_directory_name
181 188
     assert_raises RuntimeError do
182 189
       dummy_gem = Rails::GemDependency.from_directory_name('dummy-gem')

0 notes on commit f43404d

Please sign in to comment.
Something went wrong with that request. Please try again.