aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorMichael Birk <mbirk@scribd.com>2011-04-26 11:49:25 -0700
committerMichael Birk <mbirk@scribd.com>2011-05-10 22:46:41 -0700
commitd395c38f975f356ec4ff1d21bbde1665822dc274 (patch)
treebb0b1a634d149a9f6509ea513720f97df3d9922b /spec
parent9fedde21e131521b6a4274ef1f6a6330fb6b6aa4 (diff)
downloadbundler-d395c38f975f356ec4ff1d21bbde1665822dc274.tar.gz
Spec demonstrating bug in handling relative paths in Gemfiles.
Diffstat (limited to 'spec')
-rw-r--r--spec/runtime/setup_spec.rb33
1 files changed, 33 insertions, 0 deletions
diff --git a/spec/runtime/setup_spec.rb b/spec/runtime/setup_spec.rb
index c122ccc2..46a84847 100644
--- a/spec/runtime/setup_spec.rb
+++ b/spec/runtime/setup_spec.rb
@@ -685,4 +685,37 @@ describe "Bundler.setup" do
err.should be_empty
end
end
+
+ describe 'when a vendored gem specification uses the :path option' do
+ it 'should resolve paths relative to the Gemfile' do
+ path = bundled_app(File.join('vendor', 'foo'))
+ build_lib "foo", :path => path
+
+ # If the .gemspec exists, then Bundler handles the path differently.
+ # See Source::Path.load_spec_files for details.
+ FileUtils.rm(File.join(path, 'foo.gemspec'))
+
+ # Note: If the version is not specified (and the .gemspec is missing),
+ # then Bundler won't find the vendored gem at all.
+ install_gemfile <<-G
+ gem 'foo', '1.2.3', :path => 'vendor/foo'
+ G
+
+ Dir.chdir(bundled_app.dirname) do
+ # By default, Bundler looks for the Gemfile in the pwd. Since we've
+ # changed the pwd, override that default by setting BUNDLE_GEMFILE.
+ ENV['BUNDLE_GEMFILE'] = bundled_app('Gemfile')
+
+ # Bundler will resolve relative paths during setup, so for this spec
+ # we must call Bundler.setup after changing the pwd.
+ Bundler.setup
+
+ # We should be able to load the gem regardless of the pwd.
+ expect {
+ require 'foo'
+ }.to_not raise_error
+ end
+ end
+ end
+
end