mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
parent
a572e78201
commit
596588c697
Notes:
git
2020-06-18 19:15:05 +09:00
6 changed files with 24 additions and 24 deletions
|
@ -94,7 +94,7 @@ RSpec.describe "bundle open" do
|
||||||
|
|
||||||
context "when opening a default gem" do
|
context "when opening a default gem" do
|
||||||
let(:default_gems) do
|
let(:default_gems) do
|
||||||
ruby!(<<-RUBY).split("\n")
|
ruby(<<-RUBY).split("\n")
|
||||||
if Gem::Specification.is_a?(Enumerable)
|
if Gem::Specification.is_a?(Enumerable)
|
||||||
puts Gem::Specification.select(&:default_gem?).map(&:name)
|
puts Gem::Specification.select(&:default_gem?).map(&:name)
|
||||||
end
|
end
|
||||||
|
|
|
@ -34,7 +34,7 @@ RSpec.describe "double checking sources", :realworld => true, :sometimes => true
|
||||||
end
|
end
|
||||||
RUBY
|
RUBY
|
||||||
|
|
||||||
ruby! cmd
|
ruby cmd
|
||||||
ruby! cmd
|
ruby cmd
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
RSpec.describe "real world edgecases", :realworld => true, :sometimes => true do
|
RSpec.describe "real world edgecases", :realworld => true, :sometimes => true do
|
||||||
def rubygems_version(name, requirement)
|
def rubygems_version(name, requirement)
|
||||||
ruby! <<-RUBY
|
ruby <<-RUBY
|
||||||
require "#{spec_dir}/support/artifice/vcr"
|
require "#{spec_dir}/support/artifice/vcr"
|
||||||
require "#{lib_dir}/bundler"
|
require "#{lib_dir}/bundler"
|
||||||
require "#{lib_dir}/bundler/source/rubygems/remote"
|
require "#{lib_dir}/bundler/source/rubygems/remote"
|
||||||
|
|
|
@ -81,7 +81,7 @@ RSpec.describe "Bundler.load" do
|
||||||
gem "activesupport", :group => :test
|
gem "activesupport", :group => :test
|
||||||
G
|
G
|
||||||
|
|
||||||
ruby! <<-RUBY
|
ruby <<-RUBY
|
||||||
require "#{lib_dir}/bundler"
|
require "#{lib_dir}/bundler"
|
||||||
Bundler.setup :default
|
Bundler.setup :default
|
||||||
Bundler.require :default
|
Bundler.require :default
|
||||||
|
|
|
@ -107,7 +107,7 @@ RSpec.describe "Bundler.setup" do
|
||||||
|
|
||||||
context "load order" do
|
context "load order" do
|
||||||
def clean_load_path(lp)
|
def clean_load_path(lp)
|
||||||
without_bundler_load_path = ruby!("puts $LOAD_PATH").split("\n")
|
without_bundler_load_path = ruby("puts $LOAD_PATH").split("\n")
|
||||||
lp -= without_bundler_load_path
|
lp -= without_bundler_load_path
|
||||||
lp.map! {|p| p.sub(/^#{Regexp.union system_gem_path.to_s, default_bundle_path.to_s, lib_dir.to_s}/i, "") }
|
lp.map! {|p| p.sub(/^#{Regexp.union system_gem_path.to_s, default_bundle_path.to_s, lib_dir.to_s}/i, "") }
|
||||||
end
|
end
|
||||||
|
@ -143,7 +143,7 @@ RSpec.describe "Bundler.setup" do
|
||||||
gem "rails"
|
gem "rails"
|
||||||
G
|
G
|
||||||
|
|
||||||
ruby! <<-RUBY
|
ruby <<-RUBY
|
||||||
require '#{lib_dir}/bundler'
|
require '#{lib_dir}/bundler'
|
||||||
Bundler.setup
|
Bundler.setup
|
||||||
puts $LOAD_PATH
|
puts $LOAD_PATH
|
||||||
|
@ -171,7 +171,7 @@ RSpec.describe "Bundler.setup" do
|
||||||
gem "terranova"
|
gem "terranova"
|
||||||
G
|
G
|
||||||
|
|
||||||
ruby! <<-RUBY
|
ruby <<-RUBY
|
||||||
require '#{lib_dir}/bundler/setup'
|
require '#{lib_dir}/bundler/setup'
|
||||||
puts $LOAD_PATH
|
puts $LOAD_PATH
|
||||||
RUBY
|
RUBY
|
||||||
|
@ -1158,14 +1158,14 @@ end
|
||||||
|
|
||||||
context "is not present" do
|
context "is not present" do
|
||||||
it "does not change the lock" do
|
it "does not change the lock" do
|
||||||
expect { ruby! "require '#{lib_dir}/bundler/setup'" }.not_to change { lockfile }
|
expect { ruby "require '#{lib_dir}/bundler/setup'" }.not_to change { lockfile }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context "is newer" do
|
context "is newer" do
|
||||||
let(:ruby_version) { "5.5.5" }
|
let(:ruby_version) { "5.5.5" }
|
||||||
it "does not change the lock or warn" do
|
it "does not change the lock or warn" do
|
||||||
expect { ruby! "require '#{lib_dir}/bundler/setup'" }.not_to change { lockfile }
|
expect { ruby "require '#{lib_dir}/bundler/setup'" }.not_to change { lockfile }
|
||||||
expect(out).to be_empty
|
expect(out).to be_empty
|
||||||
expect(err).to be_empty
|
expect(err).to be_empty
|
||||||
end
|
end
|
||||||
|
@ -1174,7 +1174,7 @@ end
|
||||||
context "is older" do
|
context "is older" do
|
||||||
let(:ruby_version) { "1.0.0" }
|
let(:ruby_version) { "1.0.0" }
|
||||||
it "does not change the lock" do
|
it "does not change the lock" do
|
||||||
expect { ruby! "require '#{lib_dir}/bundler/setup'" }.not_to change { lockfile }
|
expect { ruby "require '#{lib_dir}/bundler/setup'" }.not_to change { lockfile }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1195,7 +1195,7 @@ end
|
||||||
|
|
||||||
it "does not load openssl" do
|
it "does not load openssl" do
|
||||||
install_gemfile ""
|
install_gemfile ""
|
||||||
ruby! <<-RUBY
|
ruby <<-RUBY
|
||||||
require "#{lib_dir}/bundler/setup"
|
require "#{lib_dir}/bundler/setup"
|
||||||
puts defined?(OpenSSL) || "undefined"
|
puts defined?(OpenSSL) || "undefined"
|
||||||
require "openssl"
|
require "openssl"
|
||||||
|
@ -1251,7 +1251,7 @@ end
|
||||||
|
|
||||||
it "activates no gems with -rbundler/setup" do
|
it "activates no gems with -rbundler/setup" do
|
||||||
install_gemfile ""
|
install_gemfile ""
|
||||||
ruby! code, :env => { "RUBYOPT" => activation_warning_hack_rubyopt + " -r#{lib_dir}/bundler/setup" }
|
ruby code, :env => { "RUBYOPT" => activation_warning_hack_rubyopt + " -r#{lib_dir}/bundler/setup" }
|
||||||
expect(out).to eq("{}")
|
expect(out).to eq("{}")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1359,7 +1359,7 @@ end
|
||||||
gem "rack"
|
gem "rack"
|
||||||
G
|
G
|
||||||
|
|
||||||
ruby! <<-RUBY
|
ruby <<-RUBY
|
||||||
require "#{lib_dir}/bundler/setup"
|
require "#{lib_dir}/bundler/setup"
|
||||||
Object.new.gem "rack"
|
Object.new.gem "rack"
|
||||||
puts Gem.loaded_specs["rack"].full_name
|
puts Gem.loaded_specs["rack"].full_name
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
RSpec.describe "Bundler.with_env helpers" do
|
RSpec.describe "Bundler.with_env helpers" do
|
||||||
def bundle_exec_ruby!(args, options = {})
|
def bundle_exec_ruby(args, options = {})
|
||||||
build_bundler_context options
|
build_bundler_context options
|
||||||
bundle "exec '#{Gem.ruby}' #{args}", options
|
bundle "exec '#{Gem.ruby}' #{args}", options
|
||||||
end
|
end
|
||||||
|
@ -23,7 +23,7 @@ RSpec.describe "Bundler.with_env helpers" do
|
||||||
RUBY
|
RUBY
|
||||||
path = `getconf PATH`.strip + "#{File::PATH_SEPARATOR}/foo"
|
path = `getconf PATH`.strip + "#{File::PATH_SEPARATOR}/foo"
|
||||||
with_path_as(path) do
|
with_path_as(path) do
|
||||||
bundle_exec_ruby!(bundled_app("source.rb").to_s)
|
bundle_exec_ruby(bundled_app("source.rb").to_s)
|
||||||
expect(last_command.stdboth).to eq(path)
|
expect(last_command.stdboth).to eq(path)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -34,7 +34,7 @@ RSpec.describe "Bundler.with_env helpers" do
|
||||||
RUBY
|
RUBY
|
||||||
gem_path = ENV["GEM_PATH"] + "#{File::PATH_SEPARATOR}/foo"
|
gem_path = ENV["GEM_PATH"] + "#{File::PATH_SEPARATOR}/foo"
|
||||||
with_gem_path_as(gem_path) do
|
with_gem_path_as(gem_path) do
|
||||||
bundle_exec_ruby!(bundled_app("source.rb").to_s)
|
bundle_exec_ruby(bundled_app("source.rb").to_s)
|
||||||
expect(last_command.stdboth).to eq(gem_path)
|
expect(last_command.stdboth).to eq(gem_path)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -52,7 +52,7 @@ RSpec.describe "Bundler.with_env helpers" do
|
||||||
path = `getconf PATH`.strip + File::PATH_SEPARATOR + File.dirname(Gem.ruby)
|
path = `getconf PATH`.strip + File::PATH_SEPARATOR + File.dirname(Gem.ruby)
|
||||||
with_path_as(path) do
|
with_path_as(path) do
|
||||||
build_bundler_context
|
build_bundler_context
|
||||||
bundle_exec_ruby!("#{bundled_app("exe.rb")} 2")
|
bundle_exec_ruby("#{bundled_app("exe.rb")} 2")
|
||||||
end
|
end
|
||||||
expect(err).to eq <<-EOS.strip
|
expect(err).to eq <<-EOS.strip
|
||||||
2 false
|
2 false
|
||||||
|
@ -65,11 +65,11 @@ RSpec.describe "Bundler.with_env helpers" do
|
||||||
# Simulate bundler has not yet been loaded
|
# Simulate bundler has not yet been loaded
|
||||||
ENV.replace(ENV.to_hash.delete_if {|k, _v| k.start_with?(Bundler::EnvironmentPreserver::BUNDLER_PREFIX) })
|
ENV.replace(ENV.to_hash.delete_if {|k, _v| k.start_with?(Bundler::EnvironmentPreserver::BUNDLER_PREFIX) })
|
||||||
|
|
||||||
original = ruby!('puts ENV.to_a.map {|e| e.join("=") }.sort.join("\n")')
|
original = ruby('puts ENV.to_a.map {|e| e.join("=") }.sort.join("\n")')
|
||||||
create_file("source.rb", <<-RUBY)
|
create_file("source.rb", <<-RUBY)
|
||||||
puts Bundler.original_env.to_a.map {|e| e.join("=") }.sort.join("\n")
|
puts Bundler.original_env.to_a.map {|e| e.join("=") }.sort.join("\n")
|
||||||
RUBY
|
RUBY
|
||||||
bundle_exec_ruby! bundled_app("source.rb")
|
bundle_exec_ruby bundled_app("source.rb")
|
||||||
expect(out).to eq original
|
expect(out).to eq original
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -80,7 +80,7 @@ RSpec.describe "Bundler.with_env helpers" do
|
||||||
print #{modified_env}.has_key?('BUNDLE_PATH')
|
print #{modified_env}.has_key?('BUNDLE_PATH')
|
||||||
RUBY
|
RUBY
|
||||||
ENV["BUNDLE_PATH"] = "./foo"
|
ENV["BUNDLE_PATH"] = "./foo"
|
||||||
bundle_exec_ruby! bundled_app("source.rb")
|
bundle_exec_ruby bundled_app("source.rb")
|
||||||
expect(last_command.stdboth).to include "false"
|
expect(last_command.stdboth).to include "false"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ RSpec.describe "Bundler.with_env helpers" do
|
||||||
RUBY
|
RUBY
|
||||||
ENV["RUBYOPT"] = "-W2 -rbundler/setup #{ENV["RUBYOPT"]}"
|
ENV["RUBYOPT"] = "-W2 -rbundler/setup #{ENV["RUBYOPT"]}"
|
||||||
simulate_bundler_version_when_missing_prerelease_default_gem_activation do
|
simulate_bundler_version_when_missing_prerelease_default_gem_activation do
|
||||||
bundle_exec_ruby! bundled_app("source.rb")
|
bundle_exec_ruby bundled_app("source.rb")
|
||||||
end
|
end
|
||||||
expect(last_command.stdboth).not_to include("-rbundler/setup")
|
expect(last_command.stdboth).not_to include("-rbundler/setup")
|
||||||
end
|
end
|
||||||
|
@ -101,7 +101,7 @@ RSpec.describe "Bundler.with_env helpers" do
|
||||||
RUBY
|
RUBY
|
||||||
ENV["RUBYLIB"] = lib_dir.to_s + File::PATH_SEPARATOR + "/foo"
|
ENV["RUBYLIB"] = lib_dir.to_s + File::PATH_SEPARATOR + "/foo"
|
||||||
ENV["BUNDLER_ORIG_RUBYLIB"] = lib_dir.to_s + File::PATH_SEPARATOR + "/foo-original"
|
ENV["BUNDLER_ORIG_RUBYLIB"] = lib_dir.to_s + File::PATH_SEPARATOR + "/foo-original"
|
||||||
bundle_exec_ruby! bundled_app("source.rb")
|
bundle_exec_ruby bundled_app("source.rb")
|
||||||
expect(last_command.stdboth).to include("/foo-original")
|
expect(last_command.stdboth).to include("/foo-original")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ RSpec.describe "Bundler.with_env helpers" do
|
||||||
RUBY
|
RUBY
|
||||||
ENV["MANPATH"] = "/foo"
|
ENV["MANPATH"] = "/foo"
|
||||||
ENV["BUNDLER_ORIG_MANPATH"] = "/foo-original"
|
ENV["BUNDLER_ORIG_MANPATH"] = "/foo-original"
|
||||||
bundle_exec_ruby! bundled_app("source.rb")
|
bundle_exec_ruby bundled_app("source.rb")
|
||||||
expect(last_command.stdboth).to include("/foo-original")
|
expect(last_command.stdboth).to include("/foo-original")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue