diff options
author | SHIBATA Hiroshi <hsbt@ruby-lang.org> | 2018-11-01 21:49:41 +0900 |
---|---|---|
committer | SHIBATA Hiroshi <hsbt@ruby-lang.org> | 2018-11-01 22:02:59 +0900 |
commit | 09bfdfa31ad5ae34d29745344493f6a63d355804 (patch) | |
tree | 9c533bb34d9fa5ea818c13e9422efee9757e1b9d /spec | |
parent | 6d2c0d2a199564a75612eb492adec5e27eaa923d (diff) | |
download | bundler-09bfdfa31ad5ae34d29745344493f6a63d355804.tar.gz |
Backport from ruby core
Diffstat (limited to 'spec')
-rw-r--r-- | spec/bundler/env_spec.rb | 2 | ||||
-rw-r--r-- | spec/bundler/mirror_spec.rb | 2 | ||||
-rw-r--r-- | spec/bundler/shared_helpers_spec.rb | 3 | ||||
-rw-r--r-- | spec/commands/binstubs_spec.rb | 4 | ||||
-rw-r--r-- | spec/commands/clean_spec.rb | 2 | ||||
-rw-r--r-- | spec/commands/exec_spec.rb | 22 | ||||
-rw-r--r-- | spec/commands/help_spec.rb | 16 | ||||
-rw-r--r-- | spec/commands/pristine_spec.rb | 2 | ||||
-rw-r--r-- | spec/install/gemfile/platform_spec.rb | 8 | ||||
-rw-r--r-- | spec/install/gems/compact_index_spec.rb | 2 | ||||
-rw-r--r-- | spec/install/gems/dependency_api_spec.rb | 2 | ||||
-rw-r--r-- | spec/lock/lockfile_bundler_1_spec.rb | 2 | ||||
-rw-r--r-- | spec/other/bundle_ruby_spec.rb | 2 | ||||
-rw-r--r-- | spec/quality_spec.rb | 39 | ||||
-rw-r--r-- | spec/runtime/gem_tasks_spec.rb | 2 | ||||
-rw-r--r-- | spec/runtime/setup_spec.rb | 11 | ||||
-rw-r--r-- | spec/runtime/with_clean_env_spec.rb | 2 | ||||
-rw-r--r-- | spec/spec_helper.rb | 2 | ||||
-rw-r--r-- | spec/support/helpers.rb | 6 | ||||
-rw-r--r-- | spec/support/path.rb | 24 |
20 files changed, 83 insertions, 72 deletions
diff --git a/spec/bundler/env_spec.rb b/spec/bundler/env_spec.rb index 10762b3cd2..20bd38b021 100644 --- a/spec/bundler/env_spec.rb +++ b/spec/bundler/env_spec.rb @@ -141,7 +141,7 @@ RSpec.describe Bundler::Env do end end - describe ".version_of" do + describe ".version_of", :ruby_repo do let(:parsed_version) { described_class.send(:version_of, "ruby") } it "strips version of new line characters" do diff --git a/spec/bundler/mirror_spec.rb b/spec/bundler/mirror_spec.rb index 0a8b9f8926..acd0895f2f 100644 --- a/spec/bundler/mirror_spec.rb +++ b/spec/bundler/mirror_spec.rb @@ -304,7 +304,7 @@ RSpec.describe Bundler::Settings::TCPSocketProbe do server.close unless server.closed? end - it "probes the server correctly" do + it "probes the server correctly", :ruby_repo do with_server_and_mirror do |server, mirror| expect(server.closed?).to be_falsey expect(probe.replies?(mirror)).to be_truthy diff --git a/spec/bundler/shared_helpers_spec.rb b/spec/bundler/shared_helpers_spec.rb index 72b1c2a51f..b66c43fd92 100644 --- a/spec/bundler/shared_helpers_spec.rb +++ b/spec/bundler/shared_helpers_spec.rb @@ -384,7 +384,8 @@ RSpec.describe Bundler::SharedHelpers do it "sets BUNDLE_BIN_PATH to the bundle executable file" do subject.set_bundle_environment - expect(ENV["BUNDLE_BIN_PATH"]).to eq(File.expand_path("../../../exe/bundle", __FILE__)) + bundle_exe = ruby_core? ? "../../../../exe/bundle" : "../../../exe/bundle" + expect(ENV["BUNDLE_BIN_PATH"]).to eq(File.expand_path(bundle_exe, __FILE__)) end end diff --git a/spec/commands/binstubs_spec.rb b/spec/commands/binstubs_spec.rb index 09371572eb..2f014f2631 100644 --- a/spec/commands/binstubs_spec.rb +++ b/spec/commands/binstubs_spec.rb @@ -192,7 +192,7 @@ RSpec.describe "bundle binstubs <gem>" do end end - context "using another binstub", :ruby_repo do + context "using another binstub" do let(:system_bundler_version) { :bundler } it "loads all gems" do sys_exec! bundled_app("bin/print_loaded_gems").to_s @@ -202,7 +202,7 @@ RSpec.describe "bundle binstubs <gem>" do context "when requesting a different bundler version" do before { lockfile lockfile.gsub(Bundler::VERSION, "999.999.999") } - it "attempts to load that version" do + it "attempts to load that version", :ruby_repo do sys_exec bundled_app("bin/rackup").to_s expect(exitstatus).to eq(42) if exitstatus expect(last_command.stderr).to include("Activating bundler (999.999.999) failed:"). diff --git a/spec/commands/clean_spec.rb b/spec/commands/clean_spec.rb index 00fa40f92e..37cbeeb4e7 100644 --- a/spec/commands/clean_spec.rb +++ b/spec/commands/clean_spec.rb @@ -734,7 +734,7 @@ RSpec.describe "bundle clean" do expect(vendored_gems("bundler/gems/very_simple_git_binary-1.0-#{revision[0..11]}")).to exist end - it "removes extension directories", :rubygems => "2.2" do + it "removes extension directories", :ruby_repo, :rubygems => "2.2" do gemfile <<-G source "file://#{gem_repo1}" diff --git a/spec/commands/exec_spec.rb b/spec/commands/exec_spec.rb index 490bedacf0..fdf60cefe7 100644 --- a/spec/commands/exec_spec.rb +++ b/spec/commands/exec_spec.rb @@ -178,7 +178,7 @@ RSpec.describe "bundle exec" do expect(out).to have_rubyopts(rubyopt) end - it "does not duplicate already exec'ed RUBYLIB", :ruby_repo do + it "does not duplicate already exec'ed RUBYLIB" do install_gemfile <<-G gem "rack" G @@ -303,35 +303,35 @@ RSpec.describe "bundle exec" do expect(out).to eq('args: ["-h"]') end - it "shows bundle-exec's man page when --help is between exec and the executable", :ruby_repo do + it "shows bundle-exec's man page when --help is between exec and the executable" do with_fake_man do bundle "#{exec} --help cat" end expect(out).to include(%(["#{root}/man/bundle-exec.1"])) end - it "shows bundle-exec's man page when --help is before exec", :ruby_repo do + it "shows bundle-exec's man page when --help is before exec" do with_fake_man do bundle "--help #{exec}" end expect(out).to include(%(["#{root}/man/bundle-exec.1"])) end - it "shows bundle-exec's man page when -h is before exec", :ruby_repo do + it "shows bundle-exec's man page when -h is before exec" do with_fake_man do bundle "-h #{exec}" end expect(out).to include(%(["#{root}/man/bundle-exec.1"])) end - it "shows bundle-exec's man page when --help is after exec", :ruby_repo do + it "shows bundle-exec's man page when --help is after exec" do with_fake_man do bundle "#{exec} --help" end expect(out).to include(%(["#{root}/man/bundle-exec.1"])) end - it "shows bundle-exec's man page when -h is after exec", :ruby_repo do + it "shows bundle-exec's man page when -h is after exec" do with_fake_man do bundle "#{exec} -h" end @@ -342,20 +342,20 @@ RSpec.describe "bundle exec" do end describe "with gem executables" do - describe "run from a random directory" do + describe "run from a random directory", :ruby_repo do before(:each) do install_gemfile <<-G gem "rack" G end - it "works when unlocked", :ruby_repo do + it "works when unlocked" do bundle "exec 'cd #{tmp("gems")} && rackup'", :env => { :RUBYOPT => "-r#{spec_dir.join("support/hax")}" } expect(out).to eq("1.0.0") expect(out).to include("1.0.0") end - it "works when locked", :ruby_repo do + it "works when locked" do expect(the_bundle).to be_locked bundle "exec 'cd #{tmp("gems")} && rackup'", :env => { :RUBYOPT => "-r#{spec_dir.join("support/hax")}" } expect(out).to include("1.0.0") @@ -445,7 +445,7 @@ RSpec.describe "bundle exec" do expect(out).to include("Installing foo 1.0") end - describe "with gems bundled via :path with invalid gemspecs" do + describe "with gems bundled via :path with invalid gemspecs", :ruby_repo do it "outputs the gemspec validation errors", :rubygems => ">= 1.7.2" do build_lib "foo" @@ -785,7 +785,7 @@ __FILE__: #{path.to_s.inspect} end end - context "nested bundle exec", :ruby_repo do + context "nested bundle exec" do let(:system_gems_to_install) { super() << :bundler } context "with shared gems disabled" do diff --git a/spec/commands/help_spec.rb b/spec/commands/help_spec.rb index cd6f13756c..56b1b6f722 100644 --- a/spec/commands/help_spec.rb +++ b/spec/commands/help_spec.rb @@ -10,21 +10,21 @@ RSpec.describe "bundle help" do expect(err).to include("running `gem cleanup bundler`.") end - it "uses mann when available", :ruby_repo do + it "uses mann when available" do with_fake_man do bundle "help gemfile" end expect(out).to eq(%(["#{root}/man/gemfile.5"])) end - it "prefixes bundle commands with bundle- when finding the groff files", :ruby_repo do + it "prefixes bundle commands with bundle- when finding the groff files" do with_fake_man do bundle "help install" end expect(out).to eq(%(["#{root}/man/bundle-install.1"])) end - it "simply outputs the txt file when there is no man on the path", :ruby_repo do + it "simply outputs the txt file when there is no man on the path" do with_path_as("") do bundle "help install" end @@ -49,28 +49,28 @@ RSpec.describe "bundle help" do expect(out).to eq("--help") end - it "is called when the --help flag is used after the command", :ruby_repo do + it "is called when the --help flag is used after the command" do with_fake_man do bundle "install --help" end expect(out).to eq(%(["#{root}/man/bundle-install.1"])) end - it "is called when the --help flag is used before the command", :ruby_repo do + it "is called when the --help flag is used before the command" do with_fake_man do bundle "--help install" end expect(out).to eq(%(["#{root}/man/bundle-install.1"])) end - it "is called when the -h flag is used before the command", :ruby_repo do + it "is called when the -h flag is used before the command" do with_fake_man do bundle "-h install" end expect(out).to eq(%(["#{root}/man/bundle-install.1"])) end - it "is called when the -h flag is used after the command", :ruby_repo do + it "is called when the -h flag is used after the command" do with_fake_man do bundle "install -h" end @@ -84,7 +84,7 @@ RSpec.describe "bundle help" do expect(out).to include('Could not find command "instill".') end - it "is called when only using the --help flag", :ruby_repo do + it "is called when only using the --help flag" do with_fake_man do bundle "--help" end diff --git a/spec/commands/pristine_spec.rb b/spec/commands/pristine_spec.rb index da6bb1c093..76848c5e44 100644 --- a/spec/commands/pristine_spec.rb +++ b/spec/commands/pristine_spec.rb @@ -42,7 +42,7 @@ RSpec.describe "bundle pristine", :ruby_repo do expect(changes_txt).to_not be_file end - it "does not delete the bundler gem", :ruby_repo do + it "does not delete the bundler gem" do ENV["BUNDLER_SPEC_KEEP_DEFAULT_BUNDLER_GEM"] = "true" system_gems :bundler bundle! "install" diff --git a/spec/install/gemfile/platform_spec.rb b/spec/install/gemfile/platform_spec.rb index 6c226eb29f..c2d4321004 100644 --- a/spec/install/gemfile/platform_spec.rb +++ b/spec/install/gemfile/platform_spec.rb @@ -96,7 +96,7 @@ RSpec.describe "bundle install across platforms" do simulate_platform java install_gemfile! <<-G - source "file://localhost/#{gem_repo4}" + source "file://#{gem_repo4}" gem "empyrean", "0.1.0" gem "pry" @@ -104,7 +104,7 @@ RSpec.describe "bundle install across platforms" do expect(the_bundle.lockfile).to read_as strip_whitespace(<<-L) GEM - remote: file://localhost/#{gem_repo4}/ + remote: file://#{gem_repo4}/ specs: coderay (1.1.2) empyrean (0.1.0) @@ -132,7 +132,7 @@ RSpec.describe "bundle install across platforms" do good_lockfile = strip_whitespace(<<-L) GEM - remote: file://localhost/#{gem_repo4}/ + remote: file://#{gem_repo4}/ specs: coderay (1.1.2) empyrean (0.1.0) @@ -164,7 +164,7 @@ RSpec.describe "bundle install across platforms" do bad_lockfile = strip_whitespace <<-L GEM - remote: file://localhost/#{gem_repo4}/ + remote: file://#{gem_repo4}/ specs: coderay (1.1.2) empyrean (0.1.0) diff --git a/spec/install/gems/compact_index_spec.rb b/spec/install/gems/compact_index_spec.rb index b06b72ecfa..02a37a77d5 100644 --- a/spec/install/gems/compact_index_spec.rb +++ b/spec/install/gems/compact_index_spec.rb @@ -717,7 +717,7 @@ The checksum of /versions does not match the checksum provided by the server! So end end - context "when ruby is compiled without openssl", :ruby_repo do + context "when ruby is compiled without openssl" do before do # Install a monkeypatch that reproduces the effects of openssl being # missing when the fetcher runs, as happens in real life. The reason diff --git a/spec/install/gems/dependency_api_spec.rb b/spec/install/gems/dependency_api_spec.rb index fe696f38c3..2ffe4b62d7 100644 --- a/spec/install/gems/dependency_api_spec.rb +++ b/spec/install/gems/dependency_api_spec.rb @@ -691,7 +691,7 @@ RSpec.describe "gemcutter's dependency API" do end end - context "when ruby is compiled without openssl", :ruby_repo do + context "when ruby is compiled without openssl" do before do # Install a monkeypatch that reproduces the effects of openssl being # missing when the fetcher runs, as happens in real life. The reason diff --git a/spec/lock/lockfile_bundler_1_spec.rb b/spec/lock/lockfile_bundler_1_spec.rb index a8615d4c89..fcdf6ebf0d 100644 --- a/spec/lock/lockfile_bundler_1_spec.rb +++ b/spec/lock/lockfile_bundler_1_spec.rb @@ -75,7 +75,7 @@ RSpec.describe "the lockfile format", :bundler => "< 2" do G end - it "does not update the lockfile's bundler version if nothing changed during bundle install" do + it "does not update the lockfile's bundler version if nothing changed during bundle install", :ruby_repo do version = "#{Bundler::VERSION.split(".").first}.0.0.0.a" lockfile <<-L diff --git a/spec/other/bundle_ruby_spec.rb b/spec/other/bundle_ruby_spec.rb index 8e365a489c..a7da9cbec9 100644 --- a/spec/other/bundle_ruby_spec.rb +++ b/spec/other/bundle_ruby_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -RSpec.describe "bundle_ruby", :ruby_repo, :bundler => "< 2" do +RSpec.describe "bundle_ruby", :bundler => "< 2" do context "without patchlevel" do it "returns the ruby version" do gemfile <<-G diff --git a/spec/quality_spec.rb b/spec/quality_spec.rb index 84da4aaeb9..e85d0bfa97 100644 --- a/spec/quality_spec.rb +++ b/spec/quality_spec.rb @@ -104,11 +104,12 @@ RSpec.describe "The library itself" do end end - it "has no malformed whitespace", :ruby_repo do + it "has no malformed whitespace" do exempt = /\.gitmodules|\.marshal|fixtures|vendor|ssl_certs|LICENSE|vcr_cassettes/ error_messages = [] Dir.chdir(root) do - `git ls-files -z`.split("\x0").each do |filename| + lib_files = ruby_core? ? `git ls-files -z -- lib/bundler lib/bundler.rb spec/bundler` : `git ls-files -z -- lib` + lib_files.split("\x0").each do |filename| next if filename =~ exempt error_messages << check_for_tab_characters(filename) error_messages << check_for_extra_spaces(filename) @@ -117,11 +118,12 @@ RSpec.describe "The library itself" do expect(error_messages.compact).to be_well_formed end - it "does not include any leftover debugging or development mechanisms", :ruby_repo do + it "does not include any leftover debugging or development mechanisms" do exempt = %r{quality_spec.rb|support/helpers|vcr_cassettes|\.md|\.ronn} error_messages = [] Dir.chdir(root) do - `git ls-files -z`.split("\x0").each do |filename| + lib_files = ruby_core? ? `git ls-files -z -- lib/bundler lib/bundler.rb spec/bundler` : `git ls-files -z -- lib` + lib_files.split("\x0").each do |filename| next if filename =~ exempt error_messages << check_for_debugging_mechanisms(filename) end @@ -129,11 +131,12 @@ RSpec.describe "The library itself" do expect(error_messages.compact).to be_well_formed end - it "does not include any unresolved merge conflicts", :ruby_repo do + it "does not include any unresolved merge conflicts" do error_messages = [] exempt = %r{lock/lockfile_(bundler_1_)?spec|quality_spec|vcr_cassettes|\.ronn|lockfile_parser\.rb} Dir.chdir(root) do - `git ls-files -z`.split("\x0").each do |filename| + lib_files = ruby_core? ? `git ls-files -z -- lib/bundler lib/bundler.rb spec/bundler` : `git ls-files -z -- lib` + lib_files.split("\x0").each do |filename| next if filename =~ exempt error_messages << check_for_git_merge_conflicts(filename) end @@ -141,7 +144,7 @@ RSpec.describe "The library itself" do expect(error_messages.compact).to be_well_formed end - it "maintains language quality of the documentation", :ruby_repo do + it "maintains language quality of the documentation" do included = /ronn/ error_messages = [] Dir.chdir(root) do @@ -154,11 +157,12 @@ RSpec.describe "The library itself" do expect(error_messages.compact).to be_well_formed end - it "maintains language quality of sentences used in source code", :ruby_repo do + it "maintains language quality of sentences used in source code" do error_messages = [] exempt = /vendor/ Dir.chdir(root) do - `git ls-files -z -- lib`.split("\x0").each do |filename| + lib_files = ruby_core? ? `git ls-files -z -- lib/bundler lib/bundler.rb` : `git ls-files -z -- lib` + lib_files.split("\x0").each do |filename| next if filename =~ exempt error_messages << check_for_expendable_words(filename) error_messages << check_for_specific_pronouns(filename) @@ -167,7 +171,7 @@ RSpec.describe "The library itself" do expect(error_messages.compact).to be_well_formed end - it "documents all used settings", :ruby_repo do + it "documents all used settings" do exemptions = %w[ auto_config_jobs cache_command_is_package @@ -191,7 +195,8 @@ RSpec.describe "The library itself" do Dir.chdir(root) do key_pattern = /([a-z\._-]+)/i - `git ls-files -z -- lib`.split("\x0").each do |filename| + lib_files = ruby_core? ? `git ls-files -z -- lib/bundler lib/bundler.rb` : `git ls-files -z -- lib` + lib_files.split("\x0").each do |filename| File.readlines(filename).each_with_index do |line, number| line.scan(/Bundler\.settings\[:#{key_pattern}\]/).flatten.each {|s| all_settings[s] << "referenced at `#{filename}:#{number.succ}`" } end @@ -216,10 +221,10 @@ RSpec.describe "The library itself" do expect(documented_settings).to be_sorted end - it "can still be built", :ruby_repo do + it "can still be built" do Dir.chdir(root) do begin - gem_command! :build, "bundler.gemspec" + gem_command! :build, gemspec if Bundler.rubygems.provides?(">= 2.4") # there's no way around this warning last_command.stderr.sub!(/^YAML safe loading.*/, "") @@ -230,12 +235,13 @@ RSpec.describe "The library itself" do end ensure # clean up the .gem generated - FileUtils.rm("bundler-#{Bundler::VERSION}.gem") + path_prefix = ruby_core? ? "lib/" : "./" + FileUtils.rm("#{path_prefix}bundler-#{Bundler::VERSION}.gem") end end end - it "does not contain any warnings", :ruby_repo do + it "does not contain any warnings" do Dir.chdir(root) do exclusions = %w[ lib/bundler/capistrano.rb @@ -244,7 +250,8 @@ RSpec.describe "The library itself" do lib/bundler/vlad.rb lib/bundler/templates/gems.rb ] - lib_files = `git ls-files -z -- lib`.split("\x0").grep(/\.rb$/) - exclusions + lib_files = ruby_core? ? `git ls-files -z -- lib/bundler lib/bundler.rb` : `git ls-files -z -- lib` + lib_files = lib_files.split("\x0").grep(/\.rb$/) - exclusions lib_files.reject! {|f| f.start_with?("lib/bundler/vendor") } lib_files.map! {|f| f.chomp(".rb") } sys_exec!("ruby -w -Ilib") do |input, _, _| diff --git a/spec/runtime/gem_tasks_spec.rb b/spec/runtime/gem_tasks_spec.rb index 1cf808f35b..de72869dc3 100644 --- a/spec/runtime/gem_tasks_spec.rb +++ b/spec/runtime/gem_tasks_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -RSpec.describe "require 'bundler/gem_tasks'" do +RSpec.describe "require 'bundler/gem_tasks'", :ruby_repo do before :each do bundled_app("foo.gemspec").open("w") do |f| f.write <<-GEMSPEC diff --git a/spec/runtime/setup_spec.rb b/spec/runtime/setup_spec.rb index 376053a625..abe9979109 100644 --- a/spec/runtime/setup_spec.rb +++ b/spec/runtime/setup_spec.rb @@ -144,7 +144,7 @@ RSpec.describe "Bundler.setup" do expect(rack_load_order).to be > 0 end - it "orders the load path correctly when there are dependencies", :ruby_repo do + it "orders the load path correctly when there are dependencies" do install_gemfile <<-G source "file://#{gem_repo1}" gem "rails" @@ -860,7 +860,7 @@ end context "with bundler is located in symlinked GEM_HOME" do let(:gem_home) { Dir.mktmpdir } let(:symlinked_gem_home) { Tempfile.new("gem_home").path } - let(:bundler_dir) { File.expand_path("../../..", __FILE__) } + let(:bundler_dir) { ruby_core? ? File.expand_path("../../../..", __FILE__) : File.expand_path("../../..", __FILE__) } let(:bundler_lib) { File.join(bundler_dir, "lib") } before do @@ -872,7 +872,8 @@ end FileUtils.ln_s(bundler_dir, File.join(gems_dir, "bundler-#{Bundler::VERSION}")) - gemspec = File.read("#{bundler_dir}/bundler.gemspec"). + gemspec_file = ruby_core? ? "#{bundler_dir}/lib/bundler.gemspec" : "#{bundler_dir}/bundler.gemspec" + gemspec = File.read(gemmspec_file). sub("Bundler::VERSION", %("#{Bundler::VERSION}")) gemspec = gemspec.lines.reject {|line| line =~ %r{lib/bundler/version} }.join @@ -881,7 +882,7 @@ end end end - it "should successfully require 'bundler/setup'" do + it "should successfully require 'bundler/setup'", :ruby_repo do install_gemfile "" ruby <<-'R', :env => { "GEM_PATH" => symlinked_gem_home }, :no_lib => true @@ -1265,7 +1266,7 @@ end expect(out).to eq("undefined\nconstant") end - describe "default gem activation", :ruby_repo do + describe "default gem activation" do let(:exemptions) do if Gem::Version.new(Gem::VERSION) >= Gem::Version.new("2.7") || ENV["RGV"] == "master" [] diff --git a/spec/runtime/with_clean_env_spec.rb b/spec/runtime/with_clean_env_spec.rb index c88da3cd02..321f5b6415 100644 --- a/spec/runtime/with_clean_env_spec.rb +++ b/spec/runtime/with_clean_env_spec.rb @@ -16,7 +16,7 @@ RSpec.describe "Bundler.with_env helpers" do bundle "install" end - it "should return the PATH present before bundle was activated", :ruby_repo do + it "should return the PATH present before bundle was activated" do code = "print Bundler.original_env['PATH']" path = `getconf PATH`.strip + "#{File::PATH_SEPARATOR}/foo" with_path_as(path) do diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 711bf576a9..7a229dc28e 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -99,7 +99,7 @@ RSpec.configure do |config| config.filter_run_excluding :git => LessThanProc.with(git_version) config.filter_run_excluding :rubygems_master => (ENV["RGV"] != "master") config.filter_run_excluding :bundler => LessThanProc.with(Bundler::VERSION.split(".")[0, 2].join(".")) - config.filter_run_excluding :ruby_repo => (ENV["BUNDLE_RUBY"] && ENV["BUNDLE_GEM"]) + config.filter_run_excluding :ruby_repo => !!(ENV["BUNDLE_RUBY"] && ENV["BUNDLE_GEM"]) config.filter_run_when_matching :focus unless ENV["CI"] diff --git a/spec/support/helpers.rb b/spec/support/helpers.rb index e3b57c1a31..b027e7a922 100644 --- a/spec/support/helpers.rb +++ b/spec/support/helpers.rb @@ -314,7 +314,11 @@ module Spec gems.each do |g| path = if g == :bundler Dir.chdir(root) { gem_command! :build, gemspec.to_s } - bundler_path = root + "bundler-#{Bundler::VERSION}.gem" + bundler_path = if ruby_core? + root + "lib/bundler-#{Bundler::VERSION}.gem" + else + root + "bundler-#{Bundler::VERSION}.gem" + end elsif g.to_s =~ %r{\A/.*\.gem\z} g else diff --git a/spec/support/path.rb b/spec/support/path.rb index 1a3444f365..cecab45c9b 100644 --- a/spec/support/path.rb +++ b/spec/support/path.rb @@ -5,19 +5,19 @@ require "pathname" module Spec module Path def root - @root ||= Pathname.new(for_ruby_core? ? "../../../.." : "../../..").expand_path(__FILE__) + @root ||= Pathname.new(ruby_core? ? "../../../.." : "../../..").expand_path(__FILE__) end def gemspec - @gemspec ||= root.join(for_ruby_core? ? "lib/bundler.gemspec" : "bundler.gemspec") + @gemspec ||= root.join(ruby_core? ? "lib/bundler.gemspec" : "bundler.gemspec") end def bindir - @bindir ||= root.join(for_ruby_core? ? "bin" : "exe") + @bindir ||= root.join(ruby_core? ? "bin" : "exe") end def spec_dir - @spec_dir ||= root.join(for_ruby_core? ? "spec/bundler" : "spec") + @spec_dir ||= root.join(ruby_core? ? "spec/bundler" : "spec") end def tmp(*path) @@ -110,19 +110,17 @@ module Spec tmp "tmpdir", *args end - extend self - - private - - def for_ruby_core? + def ruby_core? # avoid to wornings - @for_ruby_core ||= nil + @ruby_core ||= nil - if @for_ruby_core.nil? - @for_ruby_core = true & (ENV["BUNDLE_RUBY"] && ENV["BUNDLE_GEM"]) + if @ruby_core.nil? + @ruby_core = true & (ENV["BUNDLE_RUBY"] && ENV["BUNDLE_GEM"]) else - @for_ruby_core + @ruby_core end end + + extend self end end |