aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Jones <al2o3cr@gmail.com>2009-06-09 12:26:52 -0400
committerMichael Koziarski <michael@koziarski.com>2009-06-10 09:57:58 +1200
commitd7e0cb05cc8adad430d0e97efef1608eef58db80 (patch)
tree761aee1c4e95028f15a11b6595c46e10f340f62e
parent69bc2043f93890048e415dd7c5f1feba5a20d145 (diff)
downloadrails-d7e0cb05cc8adad430d0e97efef1608eef58db80.tar.gz
rails-d7e0cb05cc8adad430d0e97efef1608eef58db80.tar.bz2
rails-d7e0cb05cc8adad430d0e97efef1608eef58db80.zip
Fix incorrect specification path in GemDependency#from_directory_name
Signed-off-by: Michael Koziarski <michael@koziarski.com>
-rw-r--r--railties/lib/rails/gem_dependency.rb2
-rw-r--r--railties/test/gem_dependency_test.rb7
2 files changed, 8 insertions, 1 deletions
diff --git a/railties/lib/rails/gem_dependency.rb b/railties/lib/rails/gem_dependency.rb
index 3a82202bd0..3cc75494e4 100644
--- a/railties/lib/rails/gem_dependency.rb
+++ b/railties/lib/rails/gem_dependency.rb
@@ -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)
diff --git a/railties/test/gem_dependency_test.rb b/railties/test/gem_dependency_test.rb
index 195494a926..70f4496685 100644
--- a/railties/test/gem_dependency_test.rb
+++ b/railties/test/gem_dependency_test.rb
@@ -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')