From 53f6e471db38572fd96121aeaebacc43d2f065dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mislav=20Marohni=C4=87?= Date: Wed, 9 Dec 2009 02:37:05 +0100 Subject: [PATCH] stub `Gem.default_dir` and `Gem.path` to be identical to `Gem.dir` --- lib/bundler/templates/environment.erb | 1 + spec/bundler/cli_spec.rb | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/lib/bundler/templates/environment.erb b/lib/bundler/templates/environment.erb index b786b6f4..068491ab 100644 --- a/lib/bundler/templates/environment.erb +++ b/lib/bundler/templates/environment.erb @@ -122,6 +122,7 @@ end module Gem def self.ruby ; <%= Gem.ruby.inspect %> ; end def self.dir ; @dir ||= File.dirname(File.expand_path(__FILE__)) ; end + class << self ; alias default_dir dir; alias path dir ; end class LoadError < ::LoadError; end class Exception < RuntimeError; end class CommandLineError < Exception; end diff --git a/spec/bundler/cli_spec.rb b/spec/bundler/cli_spec.rb index b5607d32..30f8b158 100644 --- a/spec/bundler/cli_spec.rb +++ b/spec/bundler/cli_spec.rb @@ -256,6 +256,16 @@ out = run_in_context "puts Gem.dir" out.should == "#{bundled_app}/vendor/gems" end + + it "stubs out Gem.default_dir" do + out = run_in_context "puts Gem.default_dir" + out.should == "#{bundled_app}/vendor/gems" + end + + it "stubs out Gem.path" do + out = run_in_context "puts Gem.path" + out.should == "#{bundled_app}/vendor/gems" + end end describe "relative paths everywhere" do