summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTerence Lee <hone02@gmail.com>2013-12-27 21:32:02 -0500
committerTerence Lee <hone02@gmail.com>2013-12-28 00:15:45 -0500
commit7144e3579c754047ff5f7784613de1869cfbaea7 (patch)
tree719fd8f1fd32cd2f7100853833d74d5deb375571
parent631e702fd5ab7de474c0f15b512c305db2f05e6f (diff)
downloadbundler-7144e3579c754047ff5f7784613de1869cfbaea7.tar.gz
setup Ruby 1.9's default gems properly
-rw-r--r--spec/spec_helper.rb1
-rw-r--r--spec/support/helpers.rb15
2 files changed, 16 insertions, 0 deletions
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 7d3cda181a..41b6fb9d4f 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -89,6 +89,7 @@ RSpec.configure do |config|
reset!
system_gems []
in_app_root
+ copy_ruby_19_default_gems!(original_gem_path)
end
config.after :each do
diff --git a/spec/support/helpers.rb b/spec/support/helpers.rb
index 610de2d855..5625a3fde4 100644
--- a/spec/support/helpers.rb
+++ b/spec/support/helpers.rb
@@ -14,6 +14,21 @@ module Spec
FileUtils.mkdir_p(home)
end
+ def copy_ruby_19_default_gems!(original_gem_path)
+ if RUBY_VERSION >= "1.9" && RUBY_VERSION < "2.0"
+ dest_spec_dir = system_gem_path("specifications")
+ FileUtils.mkdir_p(dest_spec_dir)
+
+ original_gem_path.split(":").each do |path|
+ next if path == system_gem_path
+ Dir.glob("#{path}/specifications/*").each do |spec_path|
+ spec = eval(File.read(spec_path))
+ FileUtils.cp(spec_path, dest_spec_dir) if spec.summary.include?("is bundled with Ruby")
+ end
+ end
+ end
+ end
+
attr_reader :out, :err, :exitstatus
def in_app_root(&blk)