Permalink
Browse files

fix Gem::SourceIndex.refresh! on Rubygems 1.7 and up

  • Loading branch information...
1 parent 1e9ec08 commit a890c9cd0e41ab0ac97c1f103d9200fc95d3d226 @indirect indirect committed Apr 8, 2011
Showing with 22 additions and 1 deletion.
  1. +1 −1 lib/bundler/shared_helpers.rb
  2. +21 −0 spec/other/ext_spec.rb
@@ -126,7 +126,7 @@ def cripple_rubygems(specs)
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.7.0')
Gem::SourceIndex.send(:define_method, :initialize) do |*args|
@gems = {}
- spec_dirs = *args
+ self.spec_dirs = *args
add_specs(*specs)
end
else
View
@@ -14,3 +14,24 @@
generic(pl('x86-darwin-10')).should == pl('ruby')
end
end
+
+describe "Gem::SourceIndex#refresh!" do
+ rubygems_1_7 = Gem::Version.new(Gem::VERSION) >= Gem::Version.new("1.7.0")
+
+ before do
+ install_gemfile <<-G
+ source "file://#{gem_repo1}"
+ gem "rack"
+ G
+ end
+
+ it "does not explode when called", :if => rubygems_1_7 do
+ run "Gem.source_index.refresh!"
+ run "Gem::SourceIndex.new([]).refresh!"
+ end
+
+ it "does not explode when called", :unless => rubygems_1_7 do
+ run "Gem.source_index.refresh!"
+ run "Gem::SourceIndex.from_gems_in([]).refresh!"
+ end
+end

0 comments on commit a890c9c

Please sign in to comment.