diff options
Diffstat (limited to 'spec/bundler/commands/platform_spec.rb')
-rw-r--r-- | spec/bundler/commands/platform_spec.rb | 163 |
1 files changed, 93 insertions, 70 deletions
diff --git a/spec/bundler/commands/platform_spec.rb b/spec/bundler/commands/platform_spec.rb index 0b964eac8c..61e615acae 100644 --- a/spec/bundler/commands/platform_spec.rb +++ b/spec/bundler/commands/platform_spec.rb @@ -16,7 +16,7 @@ RSpec.describe "bundle platform" do Your platform is: #{Gem::Platform.local} Your app has gems that work on these platforms: -* #{specific_local_platform} +* #{local_platform} Your Gemfile specifies a Ruby version requirement: * ruby #{Gem.ruby_version} @@ -39,7 +39,7 @@ G Your platform is: #{Gem::Platform.local} Your app has gems that work on these platforms: -* #{specific_local_platform} +* #{local_platform} Your Gemfile specifies a Ruby version requirement: * #{Bundler::RubyVersion.system.single_version_string} @@ -60,7 +60,7 @@ G Your platform is: #{Gem::Platform.local} Your app has gems that work on these platforms: -* #{specific_local_platform} +* #{local_platform} Your Gemfile does not specify a Ruby version requirement. G @@ -80,7 +80,7 @@ G Your platform is: #{Gem::Platform.local} Your app has gems that work on these platforms: -* #{specific_local_platform} +* #{local_platform} Your Gemfile specifies a Ruby version requirement: * ruby #{not_local_ruby_version} @@ -164,7 +164,7 @@ G gem "foo" G - bundle "platform", :raise_on_error => false + bundle "platform", raise_on_error: false expect(exitstatus).not_to eq(0) end @@ -177,7 +177,7 @@ G gem "foo" G - bundle "platform", :raise_on_error => false + bundle "platform", raise_on_error: false expect(exitstatus).not_to eq(0) end @@ -190,7 +190,7 @@ G gem "foo" G - bundle "platform", :raise_on_error => false + bundle "platform", raise_on_error: false expect(exitstatus).not_to eq(0) end @@ -234,6 +234,29 @@ G expect(out).to eq("ruby 1.0.0") end + it "handles when there is a lockfile with no requirement" do + gemfile <<-G + source "#{file_uri_for(gem_repo1)}" + G + + lockfile <<-L + GEM + remote: #{file_uri_for(gem_repo1)}/ + specs: + + PLATFORMS + ruby + + DEPENDENCIES + + BUNDLED WITH + #{Bundler::VERSION} + L + + bundle "platform --ruby" + expect(out).to eq("No ruby version specified") + end + it "handles when there is a requirement in the gemfile" do gemfile <<-G source "#{file_uri_for(gem_repo1)}" @@ -324,7 +347,7 @@ G end it "doesn't install when the ruby version doesn't match" do - install_gemfile <<-G, :raise_on_error => false + install_gemfile <<-G, raise_on_error: false source "#{file_uri_for(gem_repo1)}" gem "rack" @@ -336,7 +359,7 @@ G end it "doesn't install when engine doesn't match" do - install_gemfile <<-G, :raise_on_error => false + install_gemfile <<-G, raise_on_error: false source "#{file_uri_for(gem_repo1)}" gem "rack" @@ -348,7 +371,7 @@ G end it "doesn't install when engine version doesn't match", :jruby_only do - install_gemfile <<-G, :raise_on_error => false + install_gemfile <<-G, raise_on_error: false source "#{file_uri_for(gem_repo1)}" gem "rack" @@ -360,7 +383,7 @@ G end it "doesn't install when patchlevel doesn't match" do - install_gemfile <<-G, :raise_on_error => false + install_gemfile <<-G, raise_on_error: false source "#{file_uri_for(gem_repo1)}" gem "rack" @@ -420,7 +443,7 @@ G #{ruby_version_incorrect} G - bundle :check, :raise_on_error => false + bundle :check, raise_on_error: false should_be_ruby_version_incorrect end @@ -437,7 +460,7 @@ G #{engine_incorrect} G - bundle :check, :raise_on_error => false + bundle :check, raise_on_error: false should_be_engine_incorrect end @@ -454,7 +477,7 @@ G #{engine_version_incorrect} G - bundle :check, :raise_on_error => false + bundle :check, raise_on_error: false should_be_engine_version_incorrect end @@ -471,7 +494,7 @@ G #{patchlevel_incorrect} G - bundle :check, :raise_on_error => false + bundle :check, raise_on_error: false should_be_patchlevel_incorrect end end @@ -503,7 +526,7 @@ G build_gem "activesupport", "3.0" end - bundle "update", :all => true + bundle "update", all: true expect(the_bundle).to include_gems "rack 1.2", "rack-obama 1.0", "activesupport 3.0" end @@ -523,7 +546,7 @@ G build_gem "activesupport", "3.0" end - bundle "update", :all => true + bundle "update", all: true expect(the_bundle).to include_gems "rack 1.2", "rack-obama 1.0", "activesupport 3.0" end @@ -539,7 +562,7 @@ G build_gem "activesupport", "3.0" end - bundle :update, :all => true, :raise_on_error => false + bundle :update, all: true, raise_on_error: false should_be_ruby_version_incorrect end @@ -555,7 +578,7 @@ G build_gem "activesupport", "3.0" end - bundle :update, :all => true, :raise_on_error => false + bundle :update, all: true, raise_on_error: false should_be_engine_incorrect end @@ -571,7 +594,7 @@ G build_gem "activesupport", "3.0" end - bundle :update, :all => true, :raise_on_error => false + bundle :update, all: true, raise_on_error: false should_be_engine_version_incorrect end @@ -586,7 +609,7 @@ G build_gem "activesupport", "3.0" end - bundle :update, :all => true, :raise_on_error => false + bundle :update, all: true, raise_on_error: false should_be_patchlevel_incorrect end end @@ -623,7 +646,7 @@ G expect(out).to eq(default_bundle_path("gems", "rails-2.3.2").to_s) end - it "fails if ruby version doesn't match", :bundler => "< 3" do + it "fails if ruby version doesn't match", bundler: "< 3" do gemfile <<-G source "#{file_uri_for(gem_repo1)}" gem "rails" @@ -631,11 +654,11 @@ G #{ruby_version_incorrect} G - bundle "show rails", :raise_on_error => false + bundle "show rails", raise_on_error: false should_be_ruby_version_incorrect end - it "fails if engine doesn't match", :bundler => "< 3" do + it "fails if engine doesn't match", bundler: "< 3" do gemfile <<-G source "#{file_uri_for(gem_repo1)}" gem "rails" @@ -643,11 +666,11 @@ G #{engine_incorrect} G - bundle "show rails", :raise_on_error => false + bundle "show rails", raise_on_error: false should_be_engine_incorrect end - it "fails if engine version doesn't match", :bundler => "< 3", :jruby_only => true do + it "fails if engine version doesn't match", bundler: "< 3", jruby_only: true do gemfile <<-G source "#{file_uri_for(gem_repo1)}" gem "rails" @@ -655,11 +678,11 @@ G #{engine_version_incorrect} G - bundle "show rails", :raise_on_error => false + bundle "show rails", raise_on_error: false should_be_engine_version_incorrect end - it "fails when patchlevel doesn't match", :bundler => "< 3" do + it "fails when patchlevel doesn't match", bundler: "< 3" do gemfile <<-G source "#{file_uri_for(gem_repo1)}" gem "rack" @@ -670,7 +693,7 @@ G build_gem "activesupport", "3.0" end - bundle "show rails", :raise_on_error => false + bundle "show rails", raise_on_error: false should_be_patchlevel_incorrect end end @@ -715,7 +738,7 @@ G #{ruby_version_incorrect} G - bundle :cache, :raise_on_error => false + bundle :cache, raise_on_error: false should_be_ruby_version_incorrect end @@ -727,7 +750,7 @@ G #{engine_incorrect} G - bundle :cache, :raise_on_error => false + bundle :cache, raise_on_error: false should_be_engine_incorrect end @@ -739,7 +762,7 @@ G #{engine_version_incorrect} G - bundle :cache, :raise_on_error => false + bundle :cache, raise_on_error: false should_be_engine_version_incorrect end @@ -751,7 +774,7 @@ G #{patchlevel_incorrect} G - bundle :cache, :raise_on_error => false + bundle :cache, raise_on_error: false should_be_patchlevel_incorrect end end @@ -796,7 +819,7 @@ G #{ruby_version_incorrect} G - bundle :cache, :raise_on_error => false + bundle :cache, raise_on_error: false should_be_ruby_version_incorrect end @@ -808,7 +831,7 @@ G #{engine_incorrect} G - bundle :cache, :raise_on_error => false + bundle :cache, raise_on_error: false should_be_engine_incorrect end @@ -820,7 +843,7 @@ G #{engine_version_incorrect} G - bundle :cache, :raise_on_error => false + bundle :cache, raise_on_error: false should_be_engine_version_incorrect end @@ -832,7 +855,7 @@ G #{patchlevel_incorrect} G - bundle :cache, :raise_on_error => false + bundle :cache, raise_on_error: false should_be_patchlevel_incorrect end end @@ -840,7 +863,7 @@ G context "bundle exec" do before do ENV["BUNDLER_FORCE_TTY"] = "true" - system_gems "rack-1.0.0", "rack-0.9.1", :path => default_bundle_path + system_gems "rack-1.0.0", "rack-0.9.1", path: default_bundle_path end it "activates the correct gem when ruby version matches" do @@ -856,7 +879,7 @@ G end it "activates the correct gem when ruby version matches any engine", :jruby_only do - system_gems "rack-1.0.0", "rack-0.9.1", :path => default_bundle_path + system_gems "rack-1.0.0", "rack-0.9.1", path: default_bundle_path gemfile <<-G source "#{file_uri_for(gem_repo1)}" gem "rack", "0.9.1" @@ -876,7 +899,7 @@ G #{ruby_version_incorrect} G - bundle "exec rackup", :raise_on_error => false + bundle "exec rackup", raise_on_error: false should_be_ruby_version_incorrect end @@ -888,7 +911,7 @@ G #{engine_incorrect} G - bundle "exec rackup", :raise_on_error => false + bundle "exec rackup", raise_on_error: false should_be_engine_incorrect end @@ -911,12 +934,12 @@ G #{patchlevel_incorrect} G - bundle "exec rackup", :raise_on_error => false + bundle "exec rackup", raise_on_error: false should_be_patchlevel_incorrect end end - context "bundle console", :bundler => "< 3" do + context "bundle console", bundler: "< 3" do before do install_gemfile <<-G source "#{file_uri_for(gem_repo1)}" @@ -970,7 +993,7 @@ G #{ruby_version_incorrect} G - bundle "console", :raise_on_error => false + bundle "console", raise_on_error: false should_be_ruby_version_incorrect end @@ -984,7 +1007,7 @@ G #{engine_incorrect} G - bundle "console", :raise_on_error => false + bundle "console", raise_on_error: false should_be_engine_incorrect end @@ -998,7 +1021,7 @@ G #{engine_version_incorrect} G - bundle "console", :raise_on_error => false + bundle "console", raise_on_error: false should_be_engine_version_incorrect end @@ -1012,7 +1035,7 @@ G #{patchlevel_incorrect} G - bundle "console", :raise_on_error => false + bundle "console", raise_on_error: false should_be_patchlevel_incorrect end end @@ -1059,7 +1082,7 @@ G end it "fails when ruby version doesn't match" do - install_gemfile <<-G, :raise_on_error => false + install_gemfile <<-G, raise_on_error: false source "#{file_uri_for(gem_repo1)}" gem "yard" gem "rack" @@ -1069,14 +1092,14 @@ G FileUtils.rm(bundled_app_lock) - ruby "require 'bundler/setup'", :env => { "BUNDLER_VERSION" => Bundler::VERSION }, :raise_on_error => false + ruby "require 'bundler/setup'", env: { "BUNDLER_VERSION" => Bundler::VERSION }, raise_on_error: false expect(bundled_app_lock).not_to exist should_be_ruby_version_incorrect end it "fails when engine doesn't match" do - install_gemfile <<-G, :raise_on_error => false + install_gemfile <<-G, raise_on_error: false source "#{file_uri_for(gem_repo1)}" gem "yard" gem "rack" @@ -1086,14 +1109,14 @@ G FileUtils.rm(bundled_app_lock) - ruby "require 'bundler/setup'", :env => { "BUNDLER_VERSION" => Bundler::VERSION }, :raise_on_error => false + ruby "require 'bundler/setup'", env: { "BUNDLER_VERSION" => Bundler::VERSION }, raise_on_error: false expect(bundled_app_lock).not_to exist should_be_engine_incorrect end it "fails when engine version doesn't match", :jruby_only do - install_gemfile <<-G, :raise_on_error => false + install_gemfile <<-G, raise_on_error: false source "#{file_uri_for(gem_repo1)}" gem "yard" gem "rack" @@ -1103,14 +1126,14 @@ G FileUtils.rm(bundled_app_lock) - ruby "require 'bundler/setup'", :env => { "BUNDLER_VERSION" => Bundler::VERSION }, :raise_on_error => false + ruby "require 'bundler/setup'", env: { "BUNDLER_VERSION" => Bundler::VERSION }, raise_on_error: false expect(bundled_app_lock).not_to exist should_be_engine_version_incorrect end it "fails when patchlevel doesn't match" do - install_gemfile <<-G, :raise_on_error => false + install_gemfile <<-G, raise_on_error: false source "#{file_uri_for(gem_repo1)}" gem "yard" gem "rack" @@ -1120,7 +1143,7 @@ G FileUtils.rm(bundled_app_lock) - ruby "require 'bundler/setup'", :env => { "BUNDLER_VERSION" => Bundler::VERSION }, :raise_on_error => false + ruby "require 'bundler/setup'", env: { "BUNDLER_VERSION" => Bundler::VERSION }, raise_on_error: false expect(bundled_app_lock).not_to exist should_be_patchlevel_incorrect @@ -1130,7 +1153,7 @@ G context "bundle outdated" do before do build_repo2 do - build_git "foo", :path => lib_path("foo") + build_git "foo", path: lib_path("foo") end install_gemfile <<-G @@ -1143,7 +1166,7 @@ G it "returns list of outdated gems when the ruby version matches" do update_repo2 do build_gem "activesupport", "3.0" - update_git "foo", :path => lib_path("foo") + update_git "foo", path: lib_path("foo") end gemfile <<-G @@ -1154,7 +1177,7 @@ G #{ruby_version_correct} G - bundle "outdated", :raise_on_error => false + bundle "outdated", raise_on_error: false expected_output = <<~TABLE.gsub("x", "\\\h").tr(".", "\.").strip Gem Current Latest Requested Groups @@ -1169,7 +1192,7 @@ G bundle :install update_repo2 do build_gem "activesupport", "3.0" - update_git "foo", :path => lib_path("foo") + update_git "foo", path: lib_path("foo") end gemfile <<-G @@ -1180,7 +1203,7 @@ G #{ruby_version_correct_engineless} G - bundle "outdated", :raise_on_error => false + bundle "outdated", raise_on_error: false expected_output = <<~TABLE.gsub("x", "\\\h").tr(".", "\.").strip Gem Current Latest Requested Groups @@ -1194,7 +1217,7 @@ G it "fails when the ruby version doesn't match" do update_repo2 do build_gem "activesupport", "3.0" - update_git "foo", :path => lib_path("foo") + update_git "foo", path: lib_path("foo") end gemfile <<-G @@ -1205,14 +1228,14 @@ G #{ruby_version_incorrect} G - bundle "outdated", :raise_on_error => false + bundle "outdated", raise_on_error: false should_be_ruby_version_incorrect end it "fails when the engine doesn't match" do update_repo2 do build_gem "activesupport", "3.0" - update_git "foo", :path => lib_path("foo") + update_git "foo", path: lib_path("foo") end gemfile <<-G @@ -1223,14 +1246,14 @@ G #{engine_incorrect} G - bundle "outdated", :raise_on_error => false + bundle "outdated", raise_on_error: false should_be_engine_incorrect end it "fails when the engine version doesn't match", :jruby_only do update_repo2 do build_gem "activesupport", "3.0" - update_git "foo", :path => lib_path("foo") + update_git "foo", path: lib_path("foo") end gemfile <<-G @@ -1241,14 +1264,14 @@ G #{engine_version_incorrect} G - bundle "outdated", :raise_on_error => false + bundle "outdated", raise_on_error: false should_be_engine_version_incorrect end it "fails when the patchlevel doesn't match", :jruby_only do update_repo2 do build_gem "activesupport", "3.0" - update_git "foo", :path => lib_path("foo") + update_git "foo", path: lib_path("foo") end gemfile <<-G @@ -1259,14 +1282,14 @@ G #{patchlevel_incorrect} G - bundle "outdated", :raise_on_error => false + bundle "outdated", raise_on_error: false should_be_patchlevel_incorrect end it "fails when the patchlevel is a fixnum", :jruby_only do update_repo2 do build_gem "activesupport", "3.0" - update_git "foo", :path => lib_path("foo") + update_git "foo", path: lib_path("foo") end gemfile <<-G @@ -1277,7 +1300,7 @@ G #{patchlevel_fixnum} G - bundle "outdated", :raise_on_error => false + bundle "outdated", raise_on_error: false should_be_patchlevel_fixnum end end |