diff options
author | Daniel Niknam <mhmd.niknam@gmail.com> | 2021-07-25 01:27:02 +1000 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2021-07-27 09:25:57 +0900 |
commit | 2f9e0cf1819b8679abe79494f622e1a42d7e021d (patch) | |
tree | 6ea1693b78ff3769dde6f7c5a24d2547c26f755e /spec/bundler/runtime | |
parent | b500e8fab445d5a4ad91fd71e622aff88d0c7dd6 (diff) |
[rubygems/rubygems] Explicitly define a global source for tests
This is in preparation for deprecating source-less gemfiles.
https://github.com/rubygems/rubygems/commit/d6493fa3e2
Diffstat (limited to 'spec/bundler/runtime')
-rw-r--r-- | spec/bundler/runtime/executable_spec.rb | 1 | ||||
-rw-r--r-- | spec/bundler/runtime/inline_spec.rb | 7 | ||||
-rw-r--r-- | spec/bundler/runtime/require_spec.rb | 15 | ||||
-rw-r--r-- | spec/bundler/runtime/setup_spec.rb | 18 | ||||
-rw-r--r-- | spec/bundler/runtime/with_unbundled_env_spec.rb | 2 |
5 files changed, 36 insertions, 7 deletions
diff --git a/spec/bundler/runtime/executable_spec.rb b/spec/bundler/runtime/executable_spec.rb index e39338e425..a11f547648 100644 --- a/spec/bundler/runtime/executable_spec.rb +++ b/spec/bundler/runtime/executable_spec.rb @@ -63,6 +63,7 @@ RSpec.describe "Running bin/* commands" do end gemfile <<-G + source "#{file_uri_for(gem_repo1)}" gem "rack", :path => "#{lib_path("rack")}" G diff --git a/spec/bundler/runtime/inline_spec.rb b/spec/bundler/runtime/inline_spec.rb index cfcf556658..4f39c552e8 100644 --- a/spec/bundler/runtime/inline_spec.rb +++ b/spec/bundler/runtime/inline_spec.rb @@ -48,6 +48,7 @@ RSpec.describe "bundler/inline#gemfile" do it "requires the gems" do script <<-RUBY gemfile do + source "#{file_uri_for(gem_repo1)}" path "#{lib_path}" do gem "two" end @@ -58,6 +59,7 @@ RSpec.describe "bundler/inline#gemfile" do script <<-RUBY, :raise_on_error => false gemfile do + source "#{file_uri_for(gem_repo1)}" path "#{lib_path}" do gem "eleven" end @@ -139,6 +141,7 @@ RSpec.describe "bundler/inline#gemfile" do require '#{entrypoint}' options = { :ui => Bundler::UI::Shell.new } gemfile(false, options) do + source "#{file_uri_for(gem_repo1)}" path "#{lib_path}" do gem "two" end @@ -168,6 +171,7 @@ RSpec.describe "bundler/inline#gemfile" do baz_ref = build_git("baz", "2.0.0").ref_for("HEAD") script <<-RUBY gemfile do + source "#{file_uri_for(gem_repo1)}" gem "foo", :git => #{lib_path("foo-1.0.0").to_s.dump} gem "baz", :git => #{lib_path("baz-2.0.0").to_s.dump}, :ref => #{baz_ref.dump} end @@ -184,12 +188,14 @@ RSpec.describe "bundler/inline#gemfile" do script <<-RUBY gemfile do path "#{lib_path}" do + source "#{file_uri_for(gem_repo1)}" gem "two" end end gemfile do path "#{lib_path}" do + source "#{file_uri_for(gem_repo1)}" gem "four" end end @@ -367,6 +373,7 @@ RSpec.describe "bundler/inline#gemfile" do script <<-RUBY, :dir => tmp("path_without_gemfile") gemfile do + source "#{file_uri_for(gem_repo2)}" path "#{lib_path}" do gem "foo", require: false end diff --git a/spec/bundler/runtime/require_spec.rb b/spec/bundler/runtime/require_spec.rb index a3fa4fbe47..d91b5f8666 100644 --- a/spec/bundler/runtime/require_spec.rb +++ b/spec/bundler/runtime/require_spec.rb @@ -46,6 +46,7 @@ RSpec.describe "Bundler.require" do end gemfile <<-G + source "#{file_uri_for(gem_repo1)}" path "#{lib_path}" do gem "one", :group => :bar, :require => %w[baz qux] gem "two" @@ -112,6 +113,7 @@ RSpec.describe "Bundler.require" do it "raises an exception if a require is specified but the file does not exist" do gemfile <<-G + source "#{file_uri_for(gem_repo1)}" path "#{lib_path}" do gem "two", :require => 'fail' end @@ -130,6 +132,7 @@ RSpec.describe "Bundler.require" do end gemfile <<-G + source "#{file_uri_for(gem_repo1)}" path "#{lib_path}" do gem "faulty" end @@ -146,6 +149,7 @@ RSpec.describe "Bundler.require" do end gemfile <<-G + source "#{file_uri_for(gem_repo1)}" path "#{lib_path}" do gem "loadfuuu" end @@ -172,6 +176,7 @@ RSpec.describe "Bundler.require" do it "requires gem names that are namespaced" do gemfile <<-G + source "#{file_uri_for(gem_repo1)}" path '#{lib_path}' do gem 'jquery-rails' end @@ -186,6 +191,8 @@ RSpec.describe "Bundler.require" do s.write "lib/brcrypt.rb", "BCrypt = '1.0.0'" end gemfile <<-G + source "#{file_uri_for(gem_repo1)}" + path "#{lib_path}" do gem "bcrypt-ruby" end @@ -202,6 +209,7 @@ RSpec.describe "Bundler.require" do it "does not mangle explicitly given requires" do gemfile <<-G + source "#{file_uri_for(gem_repo1)}" path "#{lib_path}" do gem 'jquery-rails', :require => 'jquery-rails' end @@ -219,6 +227,7 @@ RSpec.describe "Bundler.require" do end gemfile <<-G + source "#{file_uri_for(gem_repo1)}" path "#{lib_path}" do gem "load-fuuu" end @@ -242,6 +251,7 @@ RSpec.describe "Bundler.require" do end gemfile <<-G + source "#{file_uri_for(gem_repo1)}" path "#{lib_path}" do gem "load-fuuu" end @@ -300,6 +310,7 @@ RSpec.describe "Bundler.require" do it "works when the gems are in the Gemfile in the correct order" do gemfile <<-G + source "#{file_uri_for(gem_repo1)}" path "#{lib_path}" do gem "two" gem "one" @@ -318,6 +329,7 @@ RSpec.describe "Bundler.require" do end install_gemfile <<-G + source "#{file_uri_for(gem_repo1)}" gem "multi_gem", :require => "one", :group => :one gem "multi_gem", :require => "two", :group => :two G @@ -341,6 +353,7 @@ RSpec.describe "Bundler.require" do it "fails when the gems are in the Gemfile in the wrong order" do gemfile <<-G + source "#{file_uri_for(gem_repo1)}" path "#{lib_path}" do gem "one" gem "two" @@ -358,6 +371,7 @@ RSpec.describe "Bundler.require" do end install_gemfile <<-G + source "#{file_uri_for(gem_repo1)}" gem "busted_require" G @@ -396,6 +410,7 @@ RSpec.describe "Bundler.require" do build_git "foo" install_gemfile <<-G + source "#{file_uri_for(gem_repo1)}" gem "foo", :git => "#{lib_path("foo-1.0")}" G diff --git a/spec/bundler/runtime/setup_spec.rb b/spec/bundler/runtime/setup_spec.rb index e5662cc9ad..42bbacea0e 100644 --- a/spec/bundler/runtime/setup_spec.rb +++ b/spec/bundler/runtime/setup_spec.rb @@ -430,6 +430,7 @@ RSpec.describe "Bundler.setup" do build_git "rack", "1.0.0" gemfile <<-G + source "#{file_uri_for(gem_repo1)}" gem "rack", :git => "#{lib_path("rack-1.0.0")}" G end @@ -857,7 +858,7 @@ end end it "should not remove itself from the LOAD_PATH and require a different copy of 'bundler/setup'" do - install_gemfile "" + install_gemfile "source \"#{file_uri_for(gem_repo1)}\"" ruby <<-R, :env => { "GEM_PATH" => symlinked_gem_home } TracePoint.trace(:class) do |tp| @@ -906,6 +907,7 @@ end FileUtils.rm(File.join(path, "foo.gemspec")) install_gemfile <<-G + source "#{file_uri_for(gem_repo1)}" gem 'foo', '1.2.3', :path => 'vendor/foo' G @@ -926,6 +928,7 @@ end FileUtils.rm(File.join(absolute_path, "foo.gemspec")) gemfile <<-G + source "#{file_uri_for(gem_repo1)}" gem 'foo', '1.2.3', :path => '#{relative_path}' G @@ -944,6 +947,7 @@ end build_git "no_gemspec", :gemspec => false install_gemfile <<-G + source "#{file_uri_for(gem_repo1)}" gem "no_gemspec", "1.0", :git => "#{lib_path("no_gemspec-1.0")}" G end @@ -1046,6 +1050,7 @@ end end gemfile <<-G + source "#{file_uri_for(gem_repo1)}" gem "bar", :git => "#{lib_path("bar-1.0")}" G end @@ -1092,6 +1097,7 @@ end describe "when Bundler is bundled" do it "doesn't blow up" do install_gemfile <<-G + source "#{file_uri_for(gem_repo1)}" gem "bundler", :path => "#{root}" G @@ -1223,7 +1229,7 @@ end describe "with gemified standard libraries" do it "does not load Psych" do - gemfile "" + gemfile "source \"#{file_uri_for(gem_repo1)}\"" ruby <<-RUBY require '#{entrypoint}/setup' puts defined?(Psych::VERSION) ? Psych::VERSION : "undefined" @@ -1236,7 +1242,7 @@ end end it "does not load openssl" do - install_gemfile "" + install_gemfile "source \"#{file_uri_for(gem_repo1)}\"" ruby <<-RUBY require "bundler/setup" puts defined?(OpenSSL) || "undefined" @@ -1295,13 +1301,13 @@ end RUBY it "activates no gems with -rbundler/setup" do - install_gemfile "" + install_gemfile "source \"#{file_uri_for(gem_repo1)}\"" ruby code, :env => { "RUBYOPT" => activation_warning_hack_rubyopt + " -rbundler/setup" } expect(out).to eq("{}") end it "activates no gems with bundle exec" do - install_gemfile "" + install_gemfile "source \"#{file_uri_for(gem_repo1)}\"" create_file("script.rb", code) bundle "exec ruby ./script.rb", :env => { "RUBYOPT" => activation_warning_hack_rubyopt } expect(out).to eq("{}") @@ -1310,7 +1316,7 @@ end it "activates no gems with bundle exec that is loaded" do skip "not executable" if Gem.win_platform? - install_gemfile "" + install_gemfile "source \"#{file_uri_for(gem_repo1)}\"" create_file("script.rb", "#!/usr/bin/env ruby\n\n#{code}") FileUtils.chmod(0o777, bundled_app("script.rb")) bundle "exec ./script.rb", :artifice => nil, :env => { "RUBYOPT" => activation_warning_hack_rubyopt } diff --git a/spec/bundler/runtime/with_unbundled_env_spec.rb b/spec/bundler/runtime/with_unbundled_env_spec.rb index 03de830ea0..731a9921a2 100644 --- a/spec/bundler/runtime/with_unbundled_env_spec.rb +++ b/spec/bundler/runtime/with_unbundled_env_spec.rb @@ -8,7 +8,7 @@ RSpec.describe "Bundler.with_env helpers" do def build_bundler_context(options = {}) bundle "config set path vendor/bundle" - gemfile "" + gemfile "source \"#{file_uri_for(gem_repo1)}\"" bundle "install", options end |