diff options
Diffstat (limited to 'spec')
-rw-r--r-- | spec/bundler/commands/newgem_spec.rb | 18 | ||||
-rw-r--r-- | spec/bundler/install/gems/mirror_probe_spec.rb | 49 | ||||
-rw-r--r-- | spec/bundler/install/gems/standalone_spec.rb | 2 | ||||
-rw-r--r-- | spec/bundler/runtime/setup_spec.rb | 1 |
4 files changed, 23 insertions, 47 deletions
diff --git a/spec/bundler/commands/newgem_spec.rb b/spec/bundler/commands/newgem_spec.rb index dd2aa5c8c4..30655656a8 100644 --- a/spec/bundler/commands/newgem_spec.rb +++ b/spec/bundler/commands/newgem_spec.rb @@ -386,7 +386,6 @@ RSpec.describe "bundle gem" do it "has no rubocop offenses when using --ext=rust and --linter=rubocop flag" do skip "ruby_core has an 'ast.rb' file that gets in the middle and breaks this spec" if ruby_core? - skip "RubyGems incompatible with Rust builder" if ::Gem::Version.new("3.3.11") > ::Gem.rubygems_version bundle "gem #{gem_name} --ext=rust --linter=rubocop" bundle_exec_rubocop @@ -395,7 +394,6 @@ RSpec.describe "bundle gem" do it "has no rubocop offenses when using --ext=rust, --test=minitest, and --linter=rubocop flag" do skip "ruby_core has an 'ast.rb' file that gets in the middle and breaks this spec" if ruby_core? - skip "RubyGems incompatible with Rust builder" if ::Gem::Version.new("3.3.11") > ::Gem.rubygems_version bundle "gem #{gem_name} --ext=rust --test=minitest --linter=rubocop" bundle_exec_rubocop @@ -404,7 +402,6 @@ RSpec.describe "bundle gem" do it "has no rubocop offenses when using --ext=rust, --test=rspec, and --linter=rubocop flag" do skip "ruby_core has an 'ast.rb' file that gets in the middle and breaks this spec" if ruby_core? - skip "RubyGems incompatible with Rust builder" if ::Gem::Version.new("3.3.11") > ::Gem.rubygems_version bundle "gem #{gem_name} --ext=rust --test=rspec --linter=rubocop" bundle_exec_rubocop @@ -413,7 +410,6 @@ RSpec.describe "bundle gem" do it "has no rubocop offenses when using --ext=rust, --test=test-unit, and --linter=rubocop flag" do skip "ruby_core has an 'ast.rb' file that gets in the middle and breaks this spec" if ruby_core? - skip "RubyGems incompatible with Rust builder" if ::Gem::Version.new("3.3.11") > ::Gem.rubygems_version bundle "gem #{gem_name} --ext=rust --test=test-unit --linter=rubocop" bundle_exec_rubocop @@ -1724,24 +1720,10 @@ RSpec.describe "bundle gem" do end end - context "--ext parameter set with rust and old RubyGems" do - it "fails in friendly way" do - if ::Gem::Version.new("3.3.11") <= ::Gem.rubygems_version - skip "RubyGems compatible with Rust builder" - end - - expect do - bundle ["gem", gem_name, "--ext=rust"].compact.join(" ") - end.to raise_error(RuntimeError, /too old to build Rust extension/) - end - end - context "--ext parameter set with rust" do let(:flags) { "--ext=rust" } before do - skip "RubyGems incompatible with Rust builder" if ::Gem::Version.new("3.3.11") > ::Gem.rubygems_version - bundle ["gem", gem_name, flags].compact.join(" ") end diff --git a/spec/bundler/install/gems/mirror_probe_spec.rb b/spec/bundler/install/gems/mirror_probe_spec.rb index 5edd829e7b..fe9654e0a9 100644 --- a/spec/bundler/install/gems/mirror_probe_spec.rb +++ b/spec/bundler/install/gems/mirror_probe_spec.rb @@ -1,9 +1,6 @@ # frozen_string_literal: true RSpec.describe "fetching dependencies with a not available mirror" do - let(:mirror) { @mirror_uri } - let(:original) { @server_uri } - let(:server_port) { @server_port } let(:host) { "127.0.0.1" } before do @@ -20,13 +17,13 @@ RSpec.describe "fetching dependencies with a not available mirror" do context "with a specific fallback timeout" do before do - global_config("BUNDLE_MIRROR__HTTP://127__0__0__1:#{server_port}/__FALLBACK_TIMEOUT/" => "true", - "BUNDLE_MIRROR__HTTP://127__0__0__1:#{server_port}/" => mirror) + global_config("BUNDLE_MIRROR__HTTP://127__0__0__1:#{@server_port}/__FALLBACK_TIMEOUT/" => "true", + "BUNDLE_MIRROR__HTTP://127__0__0__1:#{@server_port}/" => @mirror_uri) end it "install a gem using the original uri when the mirror is not responding" do gemfile <<-G - source "#{original}" + source "#{@server_uri}" gem 'weakling' G @@ -41,12 +38,12 @@ RSpec.describe "fetching dependencies with a not available mirror" do context "with a global fallback timeout" do before do global_config("BUNDLE_MIRROR__ALL__FALLBACK_TIMEOUT/" => "1", - "BUNDLE_MIRROR__ALL" => mirror) + "BUNDLE_MIRROR__ALL" => @mirror_uri) end it "install a gem using the original uri when the mirror is not responding" do gemfile <<-G - source "#{original}" + source "#{@server_uri}" gem 'weakling' G @@ -60,47 +57,47 @@ RSpec.describe "fetching dependencies with a not available mirror" do context "with a specific mirror without a fallback timeout" do before do - global_config("BUNDLE_MIRROR__HTTP://127__0__0__1:#{server_port}/" => mirror) + global_config("BUNDLE_MIRROR__HTTP://127__0__0__1:#{@server_port}/" => @mirror_uri) end - it "fails to install the gem with a timeout error" do + it "fails to install the gem with a timeout error when the mirror is not responding" do gemfile <<-G - source "#{original}" + source "#{@server_uri}" gem 'weakling' G bundle :install, artifice: nil, raise_on_error: false - expect(out).to include("Fetching source index from #{mirror}") + expect(out).to include("Fetching source index from #{@mirror_uri}") err_lines = err.split("\n") - expect(err_lines).to include(%r{\ARetrying fetcher due to error \(2/4\): Bundler::HTTPError Could not fetch specs from #{mirror}/ due to underlying error <}) - expect(err_lines).to include(%r{\ARetrying fetcher due to error \(3/4\): Bundler::HTTPError Could not fetch specs from #{mirror}/ due to underlying error <}) - expect(err_lines).to include(%r{\ARetrying fetcher due to error \(4/4\): Bundler::HTTPError Could not fetch specs from #{mirror}/ due to underlying error <}) - expect(err_lines).to include(%r{\ACould not fetch specs from #{mirror}/ due to underlying error <}) + expect(err_lines).to include(%r{\ARetrying fetcher due to error \(2/4\): Bundler::HTTPError Could not fetch specs from #{@mirror_uri}/ due to underlying error <}) + expect(err_lines).to include(%r{\ARetrying fetcher due to error \(3/4\): Bundler::HTTPError Could not fetch specs from #{@mirror_uri}/ due to underlying error <}) + expect(err_lines).to include(%r{\ARetrying fetcher due to error \(4/4\): Bundler::HTTPError Could not fetch specs from #{@mirror_uri}/ due to underlying error <}) + expect(err_lines).to include(%r{\ACould not fetch specs from #{@mirror_uri}/ due to underlying error <}) end end context "with a global mirror without a fallback timeout" do before do - global_config("BUNDLE_MIRROR__ALL" => mirror) + global_config("BUNDLE_MIRROR__ALL" => @mirror_uri) end - it "fails to install the gem with a timeout error" do + it "fails to install the gem with a timeout error when the mirror is not responding" do gemfile <<-G - source "#{original}" + source "#{@server_uri}" gem 'weakling' G bundle :install, artifice: nil, raise_on_error: false - expect(out).to include("Fetching source index from #{mirror}") + expect(out).to include("Fetching source index from #{@mirror_uri}") err_lines = err.split("\n") - expect(err_lines).to include(%r{\ARetrying fetcher due to error \(2/4\): Bundler::HTTPError Could not fetch specs from #{mirror}/ due to underlying error <}) - expect(err_lines).to include(%r{\ARetrying fetcher due to error \(3/4\): Bundler::HTTPError Could not fetch specs from #{mirror}/ due to underlying error <}) - expect(err_lines).to include(%r{\ARetrying fetcher due to error \(4/4\): Bundler::HTTPError Could not fetch specs from #{mirror}/ due to underlying error <}) - expect(err_lines).to include(%r{\ACould not fetch specs from #{mirror}/ due to underlying error <}) + expect(err_lines).to include(%r{\ARetrying fetcher due to error \(2/4\): Bundler::HTTPError Could not fetch specs from #{@mirror_uri}/ due to underlying error <}) + expect(err_lines).to include(%r{\ARetrying fetcher due to error \(3/4\): Bundler::HTTPError Could not fetch specs from #{@mirror_uri}/ due to underlying error <}) + expect(err_lines).to include(%r{\ARetrying fetcher due to error \(4/4\): Bundler::HTTPError Could not fetch specs from #{@mirror_uri}/ due to underlying error <}) + expect(err_lines).to include(%r{\ACould not fetch specs from #{@mirror_uri}/ due to underlying error <}) end end @@ -108,13 +105,13 @@ RSpec.describe "fetching dependencies with a not available mirror" do @server_port = find_unused_port @server_uri = "http://#{host}:#{@server_port}" - require_relative "../../support/artifice/endpoint" + require_relative "../../support/artifice/compact_index" require_relative "../../support/silent_logger" require "rackup/server" @server_thread = Thread.new do - Rackup::Server.start(app: Endpoint, + Rackup::Server.start(app: CompactIndexAPI, Host: host, Port: @server_port, server: "webrick", diff --git a/spec/bundler/install/gems/standalone_spec.rb b/spec/bundler/install/gems/standalone_spec.rb index 50ef4dc3a7..7ad657a738 100644 --- a/spec/bundler/install/gems/standalone_spec.rb +++ b/spec/bundler/install/gems/standalone_spec.rb @@ -147,7 +147,6 @@ RSpec.shared_examples "bundle install --standalone" do it "works and points to the vendored copies, not to the default copies" do necessary_gems_in_bundle_path = ["optparse --version 0.1.1", "psych --version 3.3.2", "logger --version 1.4.3", "etc --version 1.4.3", "stringio --version 3.1.0"] - necessary_gems_in_bundle_path += ["yaml --version 0.1.1"] if Gem.rubygems_version < Gem::Version.new("3.4.a") realworld_system_gems(*necessary_gems_in_bundle_path, path: scoped_gem_path(bundled_app("bundle"))) build_gem "foo", "1.0.0", to_system: true, default: true do |s| @@ -186,7 +185,6 @@ RSpec.shared_examples "bundle install --standalone" do it "works for gems with extensions and points to the vendored copies, not to the default copies" do simulate_platform "arm64-darwin-23" do necessary_gems_in_bundle_path = ["optparse --version 0.1.1", "psych --version 3.3.2", "logger --version 1.4.3", "etc --version 1.4.3", "stringio --version 3.1.0", "shellwords --version 0.2.0", "open3 --version 0.2.1"] - necessary_gems_in_bundle_path += ["yaml --version 0.1.1"] if Gem.rubygems_version < Gem::Version.new("3.4.a") realworld_system_gems(*necessary_gems_in_bundle_path, path: scoped_gem_path(bundled_app("bundle"))) build_gem "baz", "1.0.0", to_system: true, default: true, &:add_c_extension diff --git a/spec/bundler/runtime/setup_spec.rb b/spec/bundler/runtime/setup_spec.rb index e47e64de29..b9b78cb044 100644 --- a/spec/bundler/runtime/setup_spec.rb +++ b/spec/bundler/runtime/setup_spec.rb @@ -1406,7 +1406,6 @@ end describe "default gem activation" do let(:exemptions) do exempts = %w[did_you_mean bundler uri pathname] - exempts << "etc" if (Gem.ruby_version < Gem::Version.new("3.2") || Gem.ruby_version >= Gem::Version.new("3.3.2")) && Gem.win_platform? exempts << "error_highlight" # added in Ruby 3.1 as a default gem exempts << "ruby2_keywords" # added in Ruby 3.1 as a default gem exempts << "syntax_suggest" # added in Ruby 3.2 as a default gem |