diff options
Diffstat (limited to 'spec/install/gems')
-rw-r--r-- | spec/install/gems/resolving_spec.rb | 9 | ||||
-rw-r--r-- | spec/install/gems/standalone_spec.rb | 46 | ||||
-rw-r--r-- | spec/install/gems/sudo_spec.rb | 4 |
3 files changed, 39 insertions, 20 deletions
diff --git a/spec/install/gems/resolving_spec.rb b/spec/install/gems/resolving_spec.rb index e58f32836c..f581522c71 100644 --- a/spec/install/gems/resolving_spec.rb +++ b/spec/install/gems/resolving_spec.rb @@ -142,15 +142,14 @@ RSpec.describe "bundle install with install-time dependencies" do expect(out).to_not include("Gem::InstallError: require_ruby requires Ruby version > 9000") nice_error = strip_whitespace(<<-E).strip - Bundler could not find compatible versions for gem "ruby\0": + Bundler found conflicting requirements for the Ruby\0 version: In Gemfile: - ruby\0 (#{error_message_requirement}) + Ruby\0 (#{error_message_requirement}) require_ruby was resolved to 1.0, which depends on - ruby\0 (> 9000) + Ruby\0 (> 9000) - Could not find gem 'ruby\0 (> 9000)', which is required by gem 'require_ruby', in any of the relevant sources: - the local ruby installation + Ruby\0 (> 9000), which is required by gem 'require_ruby', is not available in the local ruby installation E expect(last_command.bundler_err).to end_with(nice_error) end diff --git a/spec/install/gems/standalone_spec.rb b/spec/install/gems/standalone_spec.rb index 431854e6d5..b149d9d00b 100644 --- a/spec/install/gems/standalone_spec.rb +++ b/spec/install/gems/standalone_spec.rb @@ -54,7 +54,7 @@ RSpec.shared_examples "bundle install --standalone" do source "file://#{gem_repo1}" gem "rails" G - bundle! :install, forgotten_command_line_options(:path => "bundle").merge(:standalone => true) + bundle! :install, forgotten_command_line_options(:path => bundled_app("bundle")).merge(:standalone => true) end let(:expected_gems) do @@ -69,14 +69,15 @@ RSpec.shared_examples "bundle install --standalone" do describe "with gems with native extension" do before do - install_gemfile <<-G, forgotten_command_line_options(:path => "bundle").merge(:standalone => true) + install_gemfile <<-G, forgotten_command_line_options(:path => bundled_app("bundle")).merge(:standalone => true) source "file://#{gem_repo1}" gem "very_simple_binary" G end it "generates a bundle/bundler/setup.rb with the proper paths", :rubygems => "2.4" do - extension_line = File.read(bundled_app("bundle/bundler/setup.rb")).each_line.find {|line| line.include? "/extensions/" }.strip + expected_path = bundled_app("bundle/bundler/setup.rb") + extension_line = File.read(expected_path).each_line.find {|line| line.include? "/extensions/" }.strip expect(extension_line).to start_with '$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/extensions/' expect(extension_line).to end_with '/very_simple_binary-1.0"' end @@ -101,7 +102,7 @@ RSpec.shared_examples "bundle install --standalone" do end G end - install_gemfile <<-G, forgotten_command_line_options(:path => "bundle").merge(:standalone => true) + install_gemfile <<-G, forgotten_command_line_options(:path => bundled_app("bundle")).merge(:standalone => true) gem "bar", :git => "#{lib_path("bar-1.0")}" G end @@ -121,7 +122,7 @@ RSpec.shared_examples "bundle install --standalone" do gem "rails" gem "devise", :git => "#{lib_path("devise-1.0")}" G - bundle! :install, forgotten_command_line_options(:path => "bundle").merge(:standalone => true) + bundle! :install, forgotten_command_line_options(:path => bundled_app("bundle")).merge(:standalone => true) end let(:expected_gems) do @@ -148,7 +149,7 @@ RSpec.shared_examples "bundle install --standalone" do gem "rack-test" end G - bundle! :install, forgotten_command_line_options(:path => "bundle").merge(:standalone => true) + bundle! :install, forgotten_command_line_options(:path => bundled_app("bundle")).merge(:standalone => true) end let(:expected_gems) do @@ -161,7 +162,7 @@ RSpec.shared_examples "bundle install --standalone" do include_examples "common functionality" it "allows creating a standalone file with limited groups" do - bundle! "install", forgotten_command_line_options(:path => "bundle").merge(:standalone => "default") + bundle! :install, forgotten_command_line_options(:path => bundled_app("bundle")).merge(:standalone => "default") Dir.chdir(bundled_app) do load_error_ruby <<-RUBY, "spec", :no_lib => true @@ -179,7 +180,7 @@ RSpec.shared_examples "bundle install --standalone" do end it "allows --without to limit the groups used in a standalone" do - bundle! :install, forgotten_command_line_options(:path => "bundle", :without => "test").merge(:standalone => true) + bundle! :install, forgotten_command_line_options(:path => bundled_app("bundle"), :without => "test").merge(:standalone => true) Dir.chdir(bundled_app) do load_error_ruby <<-RUBY, "spec", :no_lib => true @@ -196,7 +197,7 @@ RSpec.shared_examples "bundle install --standalone" do expect(last_command.stderr).to eq("ZOMG LOAD ERROR") end - it "allows --path to change the location of the standalone bundle" do + it "allows --path to change the location of the standalone bundle", :bundler => "< 2" do bundle! "install", forgotten_command_line_options(:path => "path/to/bundle").merge(:standalone => true) Dir.chdir(bundled_app) do @@ -212,9 +213,26 @@ RSpec.shared_examples "bundle install --standalone" do expect(last_command.stdout).to eq("2.3.2") end + it "allows --path to change the location of the standalone bundle", :bundler => "2" do + bundle! "install", forgotten_command_line_options(:path => "path/to/bundle").merge(:standalone => true) + path = File.expand_path("path/to/bundle") + + Dir.chdir(bundled_app) do + ruby <<-RUBY, :no_lib => true + $:.unshift File.expand_path(#{path.dump}) + require "bundler/setup" + + require "actionpack" + puts ACTIONPACK + RUBY + end + + expect(last_command.stdout).to eq("2.3.2") + end + it "allows remembered --without to limit the groups used in a standalone" do bundle! :install, forgotten_command_line_options(:without => "test") - bundle! :install, forgotten_command_line_options(:path => "bundle").merge(:standalone => true) + bundle! :install, forgotten_command_line_options(:path => bundled_app("bundle")).merge(:standalone => true) Dir.chdir(bundled_app) do load_error_ruby <<-RUBY, "spec", :no_lib => true @@ -241,7 +259,7 @@ RSpec.shared_examples "bundle install --standalone" do source "#{source_uri}" gem "rails" G - bundle! :install, forgotten_command_line_options(:path => "bundle").merge(:standalone => true, :artifice => "endpoint") + bundle! :install, forgotten_command_line_options(:path => bundled_app("bundle")).merge(:standalone => true, :artifice => "endpoint") end let(:expected_gems) do @@ -261,7 +279,7 @@ RSpec.shared_examples "bundle install --standalone" do source "file://#{gem_repo1}" gem "rails" G - bundle! :install, forgotten_command_line_options(:path => "bundle").merge(:standalone => true, :binstubs => true) + bundle! :install, forgotten_command_line_options(:path => bundled_app("bundle")).merge(:standalone => true, :binstubs => true) end let(:expected_gems) do @@ -312,9 +330,7 @@ end RSpec.describe "bundle install --standalone run in a subdirectory" do before do - subdir = bundled_app("bob") - FileUtils.mkdir_p(subdir) - Dir.chdir(subdir) + Dir.chdir(bundled_app("bob").tap(&:mkpath)) end include_examples("bundle install --standalone") diff --git a/spec/install/gems/sudo_spec.rb b/spec/install/gems/sudo_spec.rb index ae94eee9c6..1781451c98 100644 --- a/spec/install/gems/sudo_spec.rb +++ b/spec/install/gems/sudo_spec.rb @@ -52,6 +52,8 @@ RSpec.describe "when using sudo", :sudo => true do end it "installs when BUNDLE_PATH is owned by root" do + bundle! "config global_path_appends_ruby_scope false" # consistency in tests between 1.x and 2.x modes + bundle_path = tmp("owned_by_root") FileUtils.mkdir_p bundle_path sudo "chown -R root #{bundle_path}" @@ -68,6 +70,8 @@ RSpec.describe "when using sudo", :sudo => true do end it "installs when BUNDLE_PATH does not exist" do + bundle! "config global_path_appends_ruby_scope false" # consistency in tests between 1.x and 2.x modes + root_path = tmp("owned_by_root") FileUtils.mkdir_p root_path sudo "chown -R root #{root_path}" |