[rubygems/rubygems] The `tmp` test helper already joins internally

https://github.com/rubygems/rubygems/commit/2d9eeadb62
This commit is contained in:
David Rodriguez 2021-10-18 11:25:28 +02:00 коммит произвёл git
Родитель c8161a4eae
Коммит f5c6a395a5
10 изменённых файлов: 68 добавлений и 68 удалений

Просмотреть файл

@ -447,7 +447,7 @@ RSpec.describe "bundle check" do
build_gem "dex-dispatch-engine"
end
build_lib("bundle-check-issue", path: tmp.join("bundle-check-issue")) do |s|
build_lib("bundle-check-issue", path: tmp("bundle-check-issue")) do |s|
s.write "Gemfile", <<-G
source "https://localgemserver.test"
@ -461,14 +461,14 @@ RSpec.describe "bundle check" do
s.add_dependency "awesome_print"
end
bundle "install", artifice: "compact_index_extra", env: { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s }, dir: tmp.join("bundle-check-issue")
bundle "install", artifice: "compact_index_extra", env: { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s }, dir: tmp("bundle-check-issue")
end
it "does not corrupt lockfile when changing version" do
version_file = tmp.join("bundle-check-issue/bundle-check-issue.gemspec")
version_file = tmp("bundle-check-issue/bundle-check-issue.gemspec")
File.write(version_file, File.read(version_file).gsub(/s\.version = .+/, "s.version = '9999'"))
bundle "check --verbose", dir: tmp.join("bundle-check-issue")
bundle "check --verbose", dir: tmp("bundle-check-issue")
checksums = checksums_section_when_existing do |c|
c.checksum gem_repo4, "awesome_print", "1.0"
@ -476,7 +476,7 @@ RSpec.describe "bundle check" do
c.checksum gem_repo2, "dex-dispatch-engine", "1.0"
end
expect(File.read(tmp.join("bundle-check-issue/Gemfile.lock"))).to eq <<~L
expect(File.read(tmp("bundle-check-issue/Gemfile.lock"))).to eq <<~L
PATH
remote: .
specs:

Просмотреть файл

@ -79,7 +79,7 @@ RSpec.describe "bundle init" do
end
context "given --gemspec option" do
let(:spec_file) { tmp.join("test.gemspec") }
let(:spec_file) { tmp("test.gemspec") }
it "should generate from an existing gemspec" do
File.open(spec_file, "w") do |file|
@ -160,7 +160,7 @@ RSpec.describe "bundle init" do
end
context "given --gemspec option" do
let(:spec_file) { tmp.join("test.gemspec") }
let(:spec_file) { tmp("test.gemspec") }
before do
File.open(spec_file, "w") do |file|

Просмотреть файл

@ -461,8 +461,8 @@ RSpec.describe "bundle install with gem sources" do
end
it "includes the gem without warning if two gemspecs add it with the same requirement" do
gem1 = tmp.join("my-gem-1")
gem2 = tmp.join("my-gem-2")
gem1 = tmp("my-gem-1")
gem2 = tmp("my-gem-2")
build_lib "my-gem", path: gem1 do |s|
s.add_development_dependency "rubocop", "~> 1.36.0"

Просмотреть файл

@ -126,7 +126,7 @@ RSpec.describe "bundle list" do
build_git "git_test", "1.0.0", path: lib_path("git_test")
build_lib("gemspec_test", path: tmp.join("gemspec_test")) do |s|
build_lib("gemspec_test", path: tmp("gemspec_test")) do |s|
s.add_dependency "bar", "=1.0.0"
end
@ -135,7 +135,7 @@ RSpec.describe "bundle list" do
gem "rack"
gem "rails"
gem "git_test", :git => "#{lib_path("git_test")}"
gemspec :path => "#{tmp.join("gemspec_test")}"
gemspec :path => "#{tmp("gemspec_test")}"
G
end

Просмотреть файл

@ -634,14 +634,14 @@ RSpec.describe "bundle remove" do
context "with gemspec" do
it "should not remove the gem" do
build_lib("foo", path: tmp.join("foo")) do |s|
build_lib("foo", path: tmp("foo")) do |s|
s.write("foo.gemspec", "")
s.add_dependency "rack"
end
install_gemfile(<<-G)
source "#{file_uri_for(gem_repo1)}"
gemspec :path => '#{tmp.join("foo")}', :name => 'foo'
gemspec :path => '#{tmp("foo")}', :name => 'foo'
G
bundle "remove foo"

Просмотреть файл

@ -39,14 +39,14 @@ RSpec.describe "bundle install from an existing gemspec" do
end
it "should install runtime and development dependencies" do
build_lib("foo", path: tmp.join("foo")) do |s|
build_lib("foo", path: tmp("foo")) do |s|
s.write("Gemfile", "source :rubygems\ngemspec")
s.add_dependency "bar", "=1.0.0"
s.add_development_dependency "bar-dev", "=1.0.0"
end
install_gemfile <<-G
source "#{file_uri_for(gem_repo2)}"
gemspec :path => '#{tmp.join("foo")}'
gemspec :path => '#{tmp("foo")}'
G
expect(the_bundle).to include_gems "bar 1.0.0"
@ -54,16 +54,16 @@ RSpec.describe "bundle install from an existing gemspec" do
end
it "that is hidden should install runtime and development dependencies" do
build_lib("foo", path: tmp.join("foo")) do |s|
build_lib("foo", path: tmp("foo")) do |s|
s.write("Gemfile", "source :rubygems\ngemspec")
s.add_dependency "bar", "=1.0.0"
s.add_development_dependency "bar-dev", "=1.0.0"
end
FileUtils.mv tmp.join("foo", "foo.gemspec"), tmp.join("foo", ".gemspec")
FileUtils.mv tmp("foo", "foo.gemspec"), tmp("foo", ".gemspec")
install_gemfile <<-G
source "#{file_uri_for(gem_repo2)}"
gemspec :path => '#{tmp.join("foo")}'
gemspec :path => '#{tmp("foo")}'
G
expect(the_bundle).to include_gems "bar 1.0.0"
@ -76,42 +76,42 @@ RSpec.describe "bundle install from an existing gemspec" do
build_gem "baz", "1.1"
end
build_lib("foo", path: tmp.join("foo")) do |s|
build_lib("foo", path: tmp("foo")) do |s|
s.write("Gemfile", "source :rubygems\ngemspec")
s.add_dependency "baz", ">= 1.0", "< 1.1"
end
install_gemfile <<-G
source "#{file_uri_for(gem_repo2)}"
gemspec :path => '#{tmp.join("foo")}'
gemspec :path => '#{tmp("foo")}'
G
expect(the_bundle).to include_gems "baz 1.0"
end
it "should raise if there are no gemspecs available" do
build_lib("foo", path: tmp.join("foo"), gemspec: false)
build_lib("foo", path: tmp("foo"), gemspec: false)
install_gemfile <<-G, raise_on_error: false
source "#{file_uri_for(gem_repo2)}"
gemspec :path => '#{tmp.join("foo")}'
gemspec :path => '#{tmp("foo")}'
G
expect(err).to match(/There are no gemspecs at #{tmp.join("foo")}/)
expect(err).to match(/There are no gemspecs at #{tmp("foo")}/)
end
it "should raise if there are too many gemspecs available" do
build_lib("foo", path: tmp.join("foo")) do |s|
build_lib("foo", path: tmp("foo")) do |s|
s.write("foo2.gemspec", build_spec("foo", "4.0").first.to_ruby)
end
install_gemfile <<-G, raise_on_error: false
source "#{file_uri_for(gem_repo2)}"
gemspec :path => '#{tmp.join("foo")}'
gemspec :path => '#{tmp("foo")}'
G
expect(err).to match(/There are multiple gemspecs at #{tmp.join("foo")}/)
expect(err).to match(/There are multiple gemspecs at #{tmp("foo")}/)
end
it "should pick a specific gemspec" do
build_lib("foo", path: tmp.join("foo")) do |s|
build_lib("foo", path: tmp("foo")) do |s|
s.write("foo2.gemspec", "")
s.add_dependency "bar", "=1.0.0"
s.add_development_dependency "bar-dev", "=1.0.0"
@ -119,7 +119,7 @@ RSpec.describe "bundle install from an existing gemspec" do
install_gemfile(<<-G)
source "#{file_uri_for(gem_repo2)}"
gemspec :path => '#{tmp.join("foo")}', :name => 'foo'
gemspec :path => '#{tmp("foo")}', :name => 'foo'
G
expect(the_bundle).to include_gems "bar 1.0.0"
@ -127,7 +127,7 @@ RSpec.describe "bundle install from an existing gemspec" do
end
it "should use a specific group for development dependencies" do
build_lib("foo", path: tmp.join("foo")) do |s|
build_lib("foo", path: tmp("foo")) do |s|
s.write("foo2.gemspec", "")
s.add_dependency "bar", "=1.0.0"
s.add_development_dependency "bar-dev", "=1.0.0"
@ -135,7 +135,7 @@ RSpec.describe "bundle install from an existing gemspec" do
install_gemfile(<<-G)
source "#{file_uri_for(gem_repo2)}"
gemspec :path => '#{tmp.join("foo")}', :name => 'foo', :development_group => :dev
gemspec :path => '#{tmp("foo")}', :name => 'foo', :development_group => :dev
G
expect(the_bundle).to include_gems "bar 1.0.0"
@ -144,33 +144,33 @@ RSpec.describe "bundle install from an existing gemspec" do
end
it "should match a lockfile even if the gemspec defines development dependencies" do
build_lib("foo", path: tmp.join("foo")) do |s|
build_lib("foo", path: tmp("foo")) do |s|
s.write("Gemfile", "source '#{file_uri_for(gem_repo1)}'\ngemspec")
s.add_dependency "actionpack", "=2.3.2"
s.add_development_dependency "rake", rake_version
end
bundle "install", dir: tmp.join("foo")
bundle "install", dir: tmp("foo")
# This should really be able to rely on $stderr, but, it's not written
# right, so we can't. In fact, this is a bug negation test, and so it'll
# ghost pass in future, and will only catch a regression if the message
# doesn't change. Exit codes should be used correctly (they can be more
# than just 0 and 1).
bundle "config set --local deployment true"
output = bundle("install", dir: tmp.join("foo"))
output = bundle("install", dir: tmp("foo"))
expect(output).not_to match(/You have added to the Gemfile/)
expect(output).not_to match(/You have deleted from the Gemfile/)
expect(output).not_to match(/the lockfile can't be updated because frozen mode is set/)
end
it "should match a lockfile without needing to re-resolve" do
build_lib("foo", path: tmp.join("foo")) do |s|
build_lib("foo", path: tmp("foo")) do |s|
s.add_dependency "rack"
end
install_gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
gemspec :path => '#{tmp.join("foo")}'
gemspec :path => '#{tmp("foo")}'
G
bundle "install", verbose: true
@ -182,14 +182,14 @@ RSpec.describe "bundle install from an existing gemspec" do
it "should match a lockfile without needing to re-resolve with development dependencies" do
simulate_platform java
build_lib("foo", path: tmp.join("foo")) do |s|
build_lib("foo", path: tmp("foo")) do |s|
s.add_dependency "rack"
s.add_development_dependency "thin"
end
install_gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
gemspec :path => '#{tmp.join("foo")}'
gemspec :path => '#{tmp("foo")}'
G
bundle "install", verbose: true
@ -199,14 +199,14 @@ RSpec.describe "bundle install from an existing gemspec" do
end
it "should match a lockfile on non-ruby platforms with a transitive platform dependency", :jruby_only do
build_lib("foo", path: tmp.join("foo")) do |s|
build_lib("foo", path: tmp("foo")) do |s|
s.add_dependency "platform_specific"
end
system_gems "platform_specific-1.0-java", path: default_bundle_path
install_gemfile <<-G
gemspec :path => '#{tmp.join("foo")}'
gemspec :path => '#{tmp("foo")}'
G
bundle "update --bundler", artifice: "compact_index", verbose: true
@ -214,13 +214,13 @@ RSpec.describe "bundle install from an existing gemspec" do
end
it "should evaluate the gemspec in its directory" do
build_lib("foo", path: tmp.join("foo"))
File.open(tmp.join("foo/foo.gemspec"), "w") do |s|
s.write "raise 'ahh' unless Dir.pwd == '#{tmp.join("foo")}'"
build_lib("foo", path: tmp("foo"))
File.open(tmp("foo/foo.gemspec"), "w") do |s|
s.write "raise 'ahh' unless Dir.pwd == '#{tmp("foo")}'"
end
install_gemfile <<-G, raise_on_error: false
gemspec :path => '#{tmp.join("foo")}'
gemspec :path => '#{tmp("foo")}'
G
expect(last_command.stdboth).not_to include("ahh")
end
@ -248,7 +248,7 @@ RSpec.describe "bundle install from an existing gemspec" do
end
it "allows conflicts" do
build_lib("foo", path: tmp.join("foo")) do |s|
build_lib("foo", path: tmp("foo")) do |s|
s.version = "1.0.0"
s.add_dependency "bar", "= 1.0.0"
end
@ -260,14 +260,14 @@ RSpec.describe "bundle install from an existing gemspec" do
install_gemfile <<-G
source "#{file_uri_for(gem_repo2)}"
gem "deps"
gemspec :path => '#{tmp.join("foo")}', :name => 'foo'
gemspec :path => '#{tmp("foo")}', :name => 'foo'
G
expect(the_bundle).to include_gems "foo 1.0.0"
end
it "does not break Gem.finish_resolve with conflicts" do
build_lib("foo", path: tmp.join("foo")) do |s|
build_lib("foo", path: tmp("foo")) do |s|
s.version = "1.0.0"
s.add_dependency "bar", "= 1.0.0"
end
@ -281,7 +281,7 @@ RSpec.describe "bundle install from an existing gemspec" do
install_gemfile <<-G
source "#{file_uri_for(gem_repo2)}"
gem "deps"
gemspec :path => '#{tmp.join("foo")}', :name => 'foo'
gemspec :path => '#{tmp("foo")}', :name => 'foo'
G
expect(the_bundle).to include_gems "foo 1.0.0"
@ -359,7 +359,7 @@ RSpec.describe "bundle install from an existing gemspec" do
let(:source_uri) { "http://localgemserver.test" }
before do
build_lib("foo", path: tmp.join("foo")) do |s|
build_lib("foo", path: tmp("foo")) do |s|
s.add_dependency "rack", "=1.0.0"
end
@ -398,7 +398,7 @@ RSpec.describe "bundle install from an existing gemspec" do
context "using JRuby with explicit platform", :jruby_only do
before do
create_file(
tmp.join("foo", "foo-java.gemspec"),
tmp("foo", "foo-java.gemspec"),
build_spec("foo", "1.0", "java") do
dep "rack", "=1.0.0"
@spec.authors = "authors"
@ -589,7 +589,7 @@ RSpec.describe "bundle install from an existing gemspec" do
context "with multiple platforms" do
before do
build_lib("foo", path: tmp.join("foo")) do |s|
build_lib("foo", path: tmp("foo")) do |s|
s.version = "1.0.0"
s.add_development_dependency "rack"
s.write "foo-universal-java.gemspec", build_spec("foo", "1.0.0", "universal-java") {|sj| sj.runtime "rack", "1.0.0" }.first.to_ruby
@ -601,7 +601,7 @@ RSpec.describe "bundle install from an existing gemspec" do
install_gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
gemspec :path => '#{tmp.join("foo")}', :name => 'foo'
gemspec :path => '#{tmp("foo")}', :name => 'foo'
G
expect(the_bundle).to include_gems "foo 1.0.0", "rack 1.0.0"
@ -613,7 +613,7 @@ RSpec.describe "bundle install from an existing gemspec" do
bundle "config set --local without development"
install_gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
gemspec :path => '#{tmp.join("foo")}', :name => 'foo'
gemspec :path => '#{tmp("foo")}', :name => 'foo'
G
expect(the_bundle).to include_gem "foo 1.0.0"
@ -623,7 +623,7 @@ RSpec.describe "bundle install from an existing gemspec" do
context "with multiple platforms and resolving for more specific platforms" do
before do
build_lib("chef", path: tmp.join("chef")) do |s|
build_lib("chef", path: tmp("chef")) do |s|
s.version = "17.1.17"
s.write "chef-universal-mingw32.gemspec", build_spec("chef", "17.1.17", "universal-mingw32") {|sw| sw.runtime "win32-api", "~> 1.5.3" }.first.to_ruby
end
@ -682,7 +682,7 @@ RSpec.describe "bundle install from an existing gemspec" do
context "with multiple locked platforms" do
before do
build_lib("activeadmin", path: tmp.join("activeadmin")) do |s|
build_lib("activeadmin", path: tmp("activeadmin")) do |s|
s.version = "2.9.0"
s.add_dependency "railties", ">= 5.2", "< 6.2"
end
@ -735,7 +735,7 @@ RSpec.describe "bundle install from an existing gemspec" do
#{Bundler::VERSION}
L
gemspec = tmp.join("activeadmin/activeadmin.gemspec")
gemspec = tmp("activeadmin/activeadmin.gemspec")
File.write(gemspec, File.read(gemspec).sub(">= 5.2", ">= 6.0"))
previous_lockfile = lockfile

Просмотреть файл

@ -1484,14 +1484,14 @@ RSpec.describe "bundle install with gems on multiple sources" do
build_gem "bar"
end
build_lib("gemspec_test", path: tmp.join("gemspec_test")) do |s|
build_lib("gemspec_test", path: tmp("gemspec_test")) do |s|
s.add_dependency "bar", "=1.0.0"
end
install_gemfile <<-G, artifice: "compact_index"
source "https://gem.repo2"
gem "rack"
gemspec :path => "#{tmp.join("gemspec_test")}"
gemspec :path => "#{tmp("gemspec_test")}"
G
end
@ -1506,7 +1506,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
build_gem "bar"
end
build_lib("gemspec_test", path: tmp.join("gemspec_test")) do |s|
build_lib("gemspec_test", path: tmp("gemspec_test")) do |s|
s.add_development_dependency "bar"
end
@ -1517,7 +1517,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
gem "bar"
end
gemspec :path => "#{tmp.join("gemspec_test")}"
gemspec :path => "#{tmp("gemspec_test")}"
G
end

Просмотреть файл

@ -1117,7 +1117,7 @@ RSpec.describe "the lockfile format" do
end
it "stores relative paths when the path is provided for gemspec" do
build_lib("foo", path: tmp.join("foo"))
build_lib("foo", path: tmp("foo"))
checksums = checksums_section_when_existing do |c|
c.no_checksum "foo", "1.0"

Просмотреть файл

@ -57,7 +57,7 @@ RSpec.describe "require 'bundler/gem_tasks'" do
context "rake build when path has spaces", :ruby_repo do
before do
spaced_bundled_app = tmp.join("bundled app")
spaced_bundled_app = tmp("bundled app")
FileUtils.cp_r bundled_app, spaced_bundled_app
bundle "exec rake build", dir: spaced_bundled_app
end
@ -69,7 +69,7 @@ RSpec.describe "require 'bundler/gem_tasks'" do
context "rake build when path has brackets", :ruby_repo do
before do
bracketed_bundled_app = tmp.join("bundled[app")
bracketed_bundled_app = tmp("bundled[app")
FileUtils.cp_r bundled_app, bracketed_bundled_app
bundle "exec rake build", dir: bracketed_bundled_app
end

Просмотреть файл

@ -109,7 +109,7 @@ module Spec
end
def home(*path)
tmp.join("home", *path)
tmp("home", *path)
end
def default_bundle_path(*path)
@ -129,13 +129,13 @@ module Spec
end
def bundled_app(*path)
root = tmp.join("bundled_app")
root = tmp("bundled_app")
FileUtils.mkdir_p(root)
root.join(*path)
end
def bundled_app2(*path)
root = tmp.join("bundled_app2")
root = tmp("bundled_app2")
FileUtils.mkdir_p(root)
root.join(*path)
end
@ -161,15 +161,15 @@ module Spec
end
def base_system_gems
tmp.join("gems/base")
tmp("gems/base")
end
def rubocop_gems
tmp.join("gems/rubocop")
tmp("gems/rubocop")
end
def standard_gems
tmp.join("gems/standard")
tmp("gems/standard")
end
def file_uri_for(path)