diff options
Diffstat (limited to 'spec/install/gems/dependency_api_spec.rb')
-rw-r--r-- | spec/install/gems/dependency_api_spec.rb | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/spec/install/gems/dependency_api_spec.rb b/spec/install/gems/dependency_api_spec.rb index c88fdcc2d2..093b314e5f 100644 --- a/spec/install/gems/dependency_api_spec.rb +++ b/spec/install/gems/dependency_api_spec.rb @@ -162,6 +162,40 @@ describe "gemcutter's dependency API" do should_be_installed "rack 1.0.0" end + it "handles host redirects" do + gemfile <<-G + source "#{source_uri}" + gem "rack" + G + + bundle :install, :artifice => "endpoint_host_redirect" + should_be_installed "rack 1.0.0" + end + + it "handles host redirects without Net::HTTP::Persistent" do + gemfile <<-G + source "#{source_uri}" + gem "rack" + G + + FileUtils.mkdir_p lib_path + File.open(lib_path("disable_net_http_persistent.rb"), "w") do |h| + h.write <<-H + module Kernel + alias require_without_disabled_net_http require + def require(*args) + raise LoadError, 'simulated' if args.first == 'openssl' && !caller.grep(/vendored_persistent/).empty? + require_without_disabled_net_http(*args) + end + end + H + end + + bundle :install, :artifice => "endpoint_host_redirect", :requires => [lib_path("disable_net_http_persistent.rb")] + expect(out).to_not match(/Too many redirects/) + should_be_installed "rack 1.0.0" + end + it "timeouts when Bundler::Fetcher redirects too much" do gemfile <<-G source "#{source_uri}" |