summaryrefslogtreecommitdiff
path: root/spec/bundler/other
diff options
context:
space:
mode:
Diffstat (limited to 'spec/bundler/other')
-rw-r--r--spec/bundler/other/cli_dispatch_spec.rb6
-rw-r--r--spec/bundler/other/ext_spec.rb28
-rw-r--r--spec/bundler/other/major_deprecation_spec.rb211
-rw-r--r--spec/bundler/other/platform_spec.rb1288
4 files changed, 145 insertions, 1388 deletions
diff --git a/spec/bundler/other/cli_dispatch_spec.rb b/spec/bundler/other/cli_dispatch_spec.rb
index 2d6080296f..48b285045a 100644
--- a/spec/bundler/other/cli_dispatch_spec.rb
+++ b/spec/bundler/other/cli_dispatch_spec.rb
@@ -2,19 +2,19 @@
RSpec.describe "bundle command names" do
it "work when given fully" do
- bundle "install", :raise_on_error => false
+ bundle "install", raise_on_error: false
expect(err).to eq("Could not locate Gemfile")
expect(last_command.stdboth).not_to include("Ambiguous command")
end
it "work when not ambiguous" do
- bundle "ins", :raise_on_error => false
+ bundle "ins", raise_on_error: false
expect(err).to eq("Could not locate Gemfile")
expect(last_command.stdboth).not_to include("Ambiguous command")
end
it "print a friendly error when ambiguous" do
- bundle "in", :raise_on_error => false
+ bundle "in", raise_on_error: false
expect(err).to eq("Ambiguous command in matches [info, init, inject, install]")
end
end
diff --git a/spec/bundler/other/ext_spec.rb b/spec/bundler/other/ext_spec.rb
index e13f62a856..4d954b474f 100644
--- a/spec/bundler/other/ext_spec.rb
+++ b/spec/bundler/other/ext_spec.rb
@@ -44,6 +44,10 @@ RSpec.describe "Bundler::GemHelpers#generic" do
expect(generic(pl("x64-mingw32"))).to eq(pl("x64-mingw32"))
expect(generic(pl("x86_64-mingw32"))).to eq(pl("x64-mingw32"))
end
+
+ it "converts 64-bit mingw UCRT platform variants into x64-mingw-ucrt" do
+ expect(generic(pl("x64-mingw-ucrt"))).to eq(pl("x64-mingw-ucrt"))
+ end
end
RSpec.describe "Gem::SourceIndex#refresh!" do
@@ -55,7 +59,27 @@ RSpec.describe "Gem::SourceIndex#refresh!" do
end
it "does not explode when called" do
- run "Gem.source_index.refresh!", :raise_on_error => false
- run "Gem::SourceIndex.new([]).refresh!", :raise_on_error => false
+ run "Gem.source_index.refresh!", raise_on_error: false
+ run "Gem::SourceIndex.new([]).refresh!", raise_on_error: false
+ end
+end
+
+RSpec.describe "Gem::NameTuple" do
+ describe "#initialize" do
+ it "creates a Gem::NameTuple with equality regardless of platform type" do
+ gem_platform = Gem::NameTuple.new "a", v("1"), pl("x86_64-linux")
+ str_platform = Gem::NameTuple.new "a", v("1"), "x86_64-linux"
+ expect(gem_platform).to eq(str_platform)
+ expect(gem_platform.hash).to eq(str_platform.hash)
+ expect(gem_platform.to_a).to eq(str_platform.to_a)
+ end
+ end
+
+ describe "#lock_name" do
+ it "returns the lock name" do
+ expect(Gem::NameTuple.new("a", v("1.0.0"), pl("x86_64-linux")).lock_name).to eq("a (1.0.0-x86_64-linux)")
+ expect(Gem::NameTuple.new("a", v("1.0.0"), "ruby").lock_name).to eq("a (1.0.0)")
+ expect(Gem::NameTuple.new("a", v("1.0.0")).lock_name).to eq("a (1.0.0)")
+ end
end
end
diff --git a/spec/bundler/other/major_deprecation_spec.rb b/spec/bundler/other/major_deprecation_spec.rb
index af6bbbce48..e7577d38b4 100644
--- a/spec/bundler/other/major_deprecation_spec.rb
+++ b/spec/bundler/other/major_deprecation_spec.rb
@@ -17,14 +17,14 @@ RSpec.describe "major deprecations" do
bundle "exec ruby -e #{source.dump}"
end
- it "is deprecated in favor of .unbundled_env", :bundler => "< 3" do
+ it "is deprecated in favor of .unbundled_env", bundler: "< 3" do
expect(deprecations).to include \
"`Bundler.clean_env` has been deprecated in favor of `Bundler.unbundled_env`. " \
"If you instead want the environment before bundler was originally loaded, use `Bundler.original_env` " \
"(called at -e:1)"
end
- pending "is removed and shows a helpful error message about it", :bundler => "3"
+ pending "is removed and shows a helpful error message about it", bundler: "3"
end
describe ".with_clean_env" do
@@ -33,7 +33,7 @@ RSpec.describe "major deprecations" do
bundle "exec ruby -e #{source.dump}"
end
- it "is deprecated in favor of .unbundled_env", :bundler => "< 3" do
+ it "is deprecated in favor of .unbundled_env", bundler: "< 3" do
expect(deprecations).to include(
"`Bundler.with_clean_env` has been deprecated in favor of `Bundler.with_unbundled_env`. " \
"If you instead want the environment before bundler was originally loaded, use `Bundler.with_original_env` " \
@@ -41,7 +41,7 @@ RSpec.describe "major deprecations" do
)
end
- pending "is removed and shows a helpful error message about it", :bundler => "3"
+ pending "is removed and shows a helpful error message about it", bundler: "3"
end
describe ".clean_system" do
@@ -50,7 +50,7 @@ RSpec.describe "major deprecations" do
bundle "exec ruby -e #{source.dump}"
end
- it "is deprecated in favor of .unbundled_system", :bundler => "< 3" do
+ it "is deprecated in favor of .unbundled_system", bundler: "< 3" do
expect(deprecations).to include(
"`Bundler.clean_system` has been deprecated in favor of `Bundler.unbundled_system`. " \
"If you instead want to run the command in the environment before bundler was originally loaded, use `Bundler.original_system` " \
@@ -58,7 +58,7 @@ RSpec.describe "major deprecations" do
)
end
- pending "is removed and shows a helpful error message about it", :bundler => "3"
+ pending "is removed and shows a helpful error message about it", bundler: "3"
end
describe ".clean_exec" do
@@ -67,7 +67,7 @@ RSpec.describe "major deprecations" do
bundle "exec ruby -e #{source.dump}"
end
- it "is deprecated in favor of .unbundled_exec", :bundler => "< 3" do
+ it "is deprecated in favor of .unbundled_exec", bundler: "< 3" do
expect(deprecations).to include(
"`Bundler.clean_exec` has been deprecated in favor of `Bundler.unbundled_exec`. " \
"If you instead want to exec to a command in the environment before bundler was originally loaded, use `Bundler.original_exec` " \
@@ -75,7 +75,7 @@ RSpec.describe "major deprecations" do
)
end
- pending "is removed and shows a helpful error message about it", :bundler => "3"
+ pending "is removed and shows a helpful error message about it", bundler: "3"
end
describe ".environment" do
@@ -84,29 +84,29 @@ RSpec.describe "major deprecations" do
bundle "exec ruby -e #{source.dump}"
end
- it "is deprecated in favor of .load", :bundler => "< 3" do
+ it "is deprecated in favor of .load", bundler: "< 3" do
expect(deprecations).to include "Bundler.environment has been removed in favor of Bundler.load (called at -e:1)"
end
- pending "is removed and shows a helpful error message about it", :bundler => "3"
+ pending "is removed and shows a helpful error message about it", bundler: "3"
end
end
describe "bundle exec --no-keep-file-descriptors" do
before do
- bundle "exec --no-keep-file-descriptors -e 1", :raise_on_error => false
+ bundle "exec --no-keep-file-descriptors -e 1", raise_on_error: false
end
- it "is deprecated", :bundler => "< 3" do
+ it "is deprecated", bundler: "< 3" do
expect(deprecations).to include "The `--no-keep-file-descriptors` has been deprecated. `bundle exec` no longer mess with your file descriptors. Close them in the exec'd script if you need to"
end
- pending "is removed and shows a helpful error message about it", :bundler => "3"
+ pending "is removed and shows a helpful error message about it", bundler: "3"
end
describe "bundle update --quiet" do
it "does not print any deprecations" do
- bundle :update, :quiet => true, :raise_on_error => false
+ bundle :update, quiet: true, raise_on_error: false
expect(deprecations).to be_empty
end
end
@@ -118,19 +118,19 @@ RSpec.describe "major deprecations" do
gem "rack"
G
- bundle "check --path vendor/bundle", :raise_on_error => false
+ bundle "check --path vendor/bundle", raise_on_error: false
end
- it "should print a deprecation warning", :bundler => "< 3" do
+ it "should print a deprecation warning", bundler: "< 3" do
expect(deprecations).to include(
"The `--path` flag is deprecated because it relies on being " \
"remembered across bundler invocations, which bundler will no " \
- "longer do in future versions. Instead please use `bundle config set --local " \
+ "longer do in future versions. Instead please use `bundle config set " \
"path 'vendor/bundle'`, and stop using this flag"
)
end
- pending "fails with a helpful error", :bundler => "3"
+ pending "fails with a helpful error", bundler: "3"
end
context "bundle check --path=" do
@@ -140,19 +140,19 @@ RSpec.describe "major deprecations" do
gem "rack"
G
- bundle "check --path=vendor/bundle", :raise_on_error => false
+ bundle "check --path=vendor/bundle", raise_on_error: false
end
- it "should print a deprecation warning", :bundler => "< 3" do
+ it "should print a deprecation warning", bundler: "< 3" do
expect(deprecations).to include(
"The `--path` flag is deprecated because it relies on being " \
"remembered across bundler invocations, which bundler will no " \
- "longer do in future versions. Instead please use `bundle config set --local " \
+ "longer do in future versions. Instead please use `bundle config set " \
"path 'vendor/bundle'`, and stop using this flag"
)
end
- pending "fails with a helpful error", :bundler => "3"
+ pending "fails with a helpful error", bundler: "3"
end
context "bundle cache --all" do
@@ -162,10 +162,10 @@ RSpec.describe "major deprecations" do
gem "rack"
G
- bundle "cache --all", :raise_on_error => false
+ bundle "cache --all", raise_on_error: false
end
- it "should print a deprecation warning", :bundler => "< 3" do
+ it "should print a deprecation warning", bundler: "< 3" do
expect(deprecations).to include(
"The `--all` flag is deprecated because it relies on being " \
"remembered across bundler invocations, which bundler will no " \
@@ -174,7 +174,7 @@ RSpec.describe "major deprecations" do
)
end
- pending "fails with a helpful error", :bundler => "3"
+ pending "fails with a helpful error", bundler: "3"
end
context "bundle cache --path" do
@@ -184,10 +184,10 @@ RSpec.describe "major deprecations" do
gem "rack"
G
- bundle "cache --path foo", :raise_on_error => false
+ bundle "cache --path foo", raise_on_error: false
end
- it "should print a deprecation warning", :bundler => "< 3" do
+ it "should print a deprecation warning", bundler: "< 3" do
expect(deprecations).to include(
"The `--path` flag is deprecated because its semantics are unclear. " \
"Use `bundle config cache_path` to configure the path of your cache of gems, " \
@@ -196,7 +196,7 @@ RSpec.describe "major deprecations" do
)
end
- pending "fails with a helpful error", :bundler => "3"
+ pending "fails with a helpful error", bundler: "3"
end
describe "bundle config" do
@@ -205,11 +205,11 @@ RSpec.describe "major deprecations" do
bundle "config"
end
- it "warns", :bundler => "3" do
+ it "warns", bundler: "3" do
expect(deprecations).to include("Using the `config` command without a subcommand [list, get, set, unset] is deprecated and will be removed in the future. Use `bundle config list` instead.")
end
- pending "fails with a helpful error", :bundler => "3"
+ pending "fails with a helpful error", bundler: "3"
end
describe "old get interface" do
@@ -217,11 +217,11 @@ RSpec.describe "major deprecations" do
bundle "config waka"
end
- it "warns", :bundler => "3" do
+ it "warns", bundler: "3" do
expect(deprecations).to include("Using the `config` command without a subcommand [list, get, set, unset] is deprecated and will be removed in the future. Use `bundle config get waka` instead.")
end
- pending "fails with a helpful error", :bundler => "3"
+ pending "fails with a helpful error", bundler: "3"
end
describe "old set interface" do
@@ -229,11 +229,11 @@ RSpec.describe "major deprecations" do
bundle "config waka wakapun"
end
- it "warns", :bundler => "3" do
+ it "warns", bundler: "3" do
expect(deprecations).to include("Using the `config` command without a subcommand [list, get, set, unset] is deprecated and will be removed in the future. Use `bundle config set waka wakapun` instead.")
end
- pending "fails with a helpful error", :bundler => "3"
+ pending "fails with a helpful error", bundler: "3"
end
describe "old set interface with --local" do
@@ -241,11 +241,11 @@ RSpec.describe "major deprecations" do
bundle "config --local waka wakapun"
end
- it "warns", :bundler => "3" do
+ it "warns", bundler: "3" do
expect(deprecations).to include("Using the `config` command without a subcommand [list, get, set, unset] is deprecated and will be removed in the future. Use `bundle config set --local waka wakapun` instead.")
end
- pending "fails with a helpful error", :bundler => "3"
+ pending "fails with a helpful error", bundler: "3"
end
describe "old set interface with --global" do
@@ -253,11 +253,11 @@ RSpec.describe "major deprecations" do
bundle "config --global waka wakapun"
end
- it "warns", :bundler => "3" do
+ it "warns", bundler: "3" do
expect(deprecations).to include("Using the `config` command without a subcommand [list, get, set, unset] is deprecated and will be removed in the future. Use `bundle config set --global waka wakapun` instead.")
end
- pending "fails with a helpful error", :bundler => "3"
+ pending "fails with a helpful error", bundler: "3"
end
describe "old unset interface" do
@@ -265,11 +265,11 @@ RSpec.describe "major deprecations" do
bundle "config --delete waka"
end
- it "warns", :bundler => "3" do
+ it "warns", bundler: "3" do
expect(deprecations).to include("Using the `config` command without a subcommand [list, get, set, unset] is deprecated and will be removed in the future. Use `bundle config unset waka` instead.")
end
- pending "fails with a helpful error", :bundler => "3"
+ pending "fails with a helpful error", bundler: "3"
end
describe "old unset interface with --local" do
@@ -277,11 +277,11 @@ RSpec.describe "major deprecations" do
bundle "config --delete --local waka"
end
- it "warns", :bundler => "3" do
+ it "warns", bundler: "3" do
expect(deprecations).to include("Using the `config` command without a subcommand [list, get, set, unset] is deprecated and will be removed in the future. Use `bundle config unset --local waka` instead.")
end
- pending "fails with a helpful error", :bundler => "3"
+ pending "fails with a helpful error", bundler: "3"
end
describe "old unset interface with --global" do
@@ -289,11 +289,11 @@ RSpec.describe "major deprecations" do
bundle "config --delete --global waka"
end
- it "warns", :bundler => "3" do
+ it "warns", bundler: "3" do
expect(deprecations).to include("Using the `config` command without a subcommand [list, get, set, unset] is deprecated and will be removed in the future. Use `bundle config unset --global waka` instead.")
end
- pending "fails with a helpful error", :bundler => "3"
+ pending "fails with a helpful error", bundler: "3"
end
end
@@ -305,12 +305,12 @@ RSpec.describe "major deprecations" do
G
end
- it "warns when no options are given", :bundler => "3" do
+ it "warns when no options are given", bundler: "3" do
bundle "update"
expect(deprecations).to include("Pass --all to `bundle update` to update everything")
end
- pending "fails with a helpful error when no options are given", :bundler => "3"
+ pending "fails with a helpful error when no options are given", bundler: "3"
it "does not warn when --all is passed" do
bundle "update --all"
@@ -320,17 +320,17 @@ RSpec.describe "major deprecations" do
describe "bundle install --binstubs" do
before do
- install_gemfile <<-G, :binstubs => true
+ install_gemfile <<-G, binstubs: true
source "#{file_uri_for(gem_repo1)}"
gem "rack"
G
end
- it "should output a deprecation warning", :bundler => "< 3" do
+ it "should output a deprecation warning", bundler: "< 3" do
expect(deprecations).to include("The --binstubs option will be removed in favor of `bundle binstubs --all`")
end
- pending "fails with a helpful error", :bundler => "3"
+ pending "fails with a helpful error", bundler: "3"
end
context "bundle install with both gems.rb and Gemfile present" do
@@ -370,16 +370,16 @@ RSpec.describe "major deprecations" do
end
{
- "clean" => ["clean", true],
- "deployment" => ["deployment", true],
- "frozen" => ["frozen", true],
- "no-deployment" => ["deployment", false],
- "no-prune" => ["no_prune", true],
- "path" => ["path", "vendor/bundle"],
- "shebang" => ["shebang", "ruby27"],
- "system" => ["system", true],
- "without" => ["without", "development"],
- "with" => ["with", "development"],
+ "clean" => ["clean", "true"],
+ "deployment" => ["deployment", "true"],
+ "frozen" => ["frozen", "true"],
+ "no-deployment" => ["deployment", "false"],
+ "no-prune" => ["no_prune", "true"],
+ "path" => ["path", "'vendor/bundle'"],
+ "shebang" => ["shebang", "'ruby27'"],
+ "system" => ["path.system", "true"],
+ "without" => ["without", "'development'"],
+ "with" => ["with", "'development'"],
}.each do |name, expectations|
option_name, value = *expectations
flag_name = "--#{name}"
@@ -390,16 +390,16 @@ RSpec.describe "major deprecations" do
bundle "install #{flag_name} #{value}"
end
- it "should print a deprecation warning", :bundler => "< 3" do
+ it "should print a deprecation warning", bundler: "< 3" do
expect(deprecations).to include(
"The `#{flag_name}` flag is deprecated because it relies on " \
"being remembered across bundler invocations, which bundler " \
"will no longer do in future versions. Instead please use " \
- "`bundle config set --local #{option_name} '#{value}'`, and stop using this flag"
+ "`bundle config set #{option_name} #{value}`, and stop using this flag"
)
end
- pending "fails with a helpful error", :bundler => "3"
+ pending "fails with a helpful error", bundler: "3"
end
end
end
@@ -412,20 +412,20 @@ RSpec.describe "major deprecations" do
G
end
- it "shows a deprecation", :bundler => "< 3" do
+ it "shows a deprecation", bundler: "< 3" do
expect(deprecations).to include(
- "Your Gemfile contains multiple primary sources. " \
+ "Your Gemfile contains multiple global sources. " \
"Using `source` more than once without a block is a security risk, and " \
"may result in installing unexpected gems. To resolve this warning, use " \
"a block to indicate which gems should come from the secondary source."
)
end
- it "doesn't show lockfile deprecations if there's a lockfile", :bundler => "< 3" do
+ it "doesn't show lockfile deprecations if there's a lockfile", bundler: "< 3" do
bundle "install"
expect(deprecations).to include(
- "Your Gemfile contains multiple primary sources. " \
+ "Your Gemfile contains multiple global sources. " \
"Using `source` more than once without a block is a security risk, and " \
"may result in installing unexpected gems. To resolve this warning, use " \
"a block to indicate which gems should come from the secondary source."
@@ -438,7 +438,7 @@ RSpec.describe "major deprecations" do
bundle "install"
expect(deprecations).to include(
- "Your Gemfile contains multiple primary sources. " \
+ "Your Gemfile contains multiple global sources. " \
"Using `source` more than once without a block is a security risk, and " \
"may result in installing unexpected gems. To resolve this warning, use " \
"a block to indicate which gems should come from the secondary source."
@@ -449,7 +449,7 @@ RSpec.describe "major deprecations" do
)
end
- pending "fails with a helpful error", :bundler => "3"
+ pending "fails with a helpful error", bundler: "3"
end
context "bundle install in frozen mode with a lockfile with a single rubygems section with multiple remotes" do
@@ -485,13 +485,13 @@ RSpec.describe "major deprecations" do
bundle "config set --local frozen true"
end
- it "shows a deprecation", :bundler => "< 3" do
+ it "shows a deprecation", bundler: "< 3" do
bundle "install"
expect(deprecations).to include("Your lockfile contains a single rubygems source section with multiple remotes, which is insecure. Make sure you run `bundle install` in non frozen mode and commit the result to make your lockfile secure.")
end
- pending "fails with a helpful error", :bundler => "3"
+ pending "fails with a helpful error", bundler: "3"
end
context "when Bundler.setup is run in a ruby script" do
@@ -503,7 +503,7 @@ RSpec.describe "major deprecations" do
G
ruby <<-RUBY
- require '#{entrypoint}'
+ require 'bundler'
Bundler.setup
Bundler.setup
@@ -519,19 +519,19 @@ RSpec.describe "major deprecations" do
context "when `bundler/deployment` is required in a ruby script" do
before do
- ruby(<<-RUBY, :env => env_for_missing_prerelease_default_gem_activation)
+ ruby <<-RUBY
require 'bundler/deployment'
RUBY
end
- it "should print a capistrano deprecation warning", :bundler => "< 3" do
+ it "should print a capistrano deprecation warning", bundler: "< 3" do
expect(deprecations).to include("Bundler no longer integrates " \
"with Capistrano, but Capistrano provides " \
"its own integration with Bundler via the " \
"capistrano-bundler gem. Use it instead.")
end
- pending "fails with a helpful error", :bundler => "3"
+ pending "fails with a helpful error", bundler: "3"
end
context "bundle show" do
@@ -547,11 +547,11 @@ RSpec.describe "major deprecations" do
bundle "show --outdated"
end
- it "prints a deprecation warning informing about its removal", :bundler => "< 3" do
+ it "prints a deprecation warning informing about its removal", bundler: "< 3" do
expect(deprecations).to include("the `--outdated` flag to `bundle show` was undocumented and will be removed without replacement")
end
- pending "fails with a helpful message", :bundler => "3"
+ pending "fails with a helpful message", bundler: "3"
end
end
@@ -564,51 +564,72 @@ RSpec.describe "major deprecations" do
end
context "with --install" do
- it "shows a deprecation warning", :bundler => "< 3" do
+ it "shows a deprecation warning", bundler: "< 3" do
bundle "remove rack --install"
expect(err).to include "[DEPRECATED] The `--install` flag has been deprecated. `bundle install` is triggered by default."
end
- pending "fails with a helpful message", :bundler => "3"
+ pending "fails with a helpful message", bundler: "3"
end
end
context "bundle console" do
before do
- bundle "console", :raise_on_error => false
+ bundle "console", raise_on_error: false
end
- it "prints a deprecation warning", :bundler => "< 3" do
+ it "prints a deprecation warning", bundler: "< 3" do
expect(deprecations).to include \
"bundle console will be replaced by `bin/console` generated by `bundle gem <name>`"
end
- pending "fails with a helpful message", :bundler => "3"
+ pending "fails with a helpful message", bundler: "3"
end
- context "bundle viz" do
+ context "bundle viz", :realworld do
before do
- graphviz_version = RUBY_VERSION >= "2.4" ? "1.2.5" : "1.2.4"
- realworld_system_gems "ruby-graphviz --version #{graphviz_version}"
+ realworld_system_gems "ruby-graphviz --version 1.2.5"
create_file "gems.rb", "source \"#{file_uri_for(gem_repo1)}\""
bundle "viz"
end
- it "prints a deprecation warning", :bundler => "< 3" do
+ it "prints a deprecation warning", bundler: "< 3" do
expect(deprecations).to include "The `viz` command has been renamed to `graph` and moved to a plugin. See https://github.com/rubygems/bundler-graph"
end
- pending "fails with a helpful message", :bundler => "3"
+ pending "fails with a helpful message", bundler: "3"
end
- describe "deprecating rubocop", :readline do
+ context "bundle plugin install --local_git" do
+ before do
+ build_git "foo" do |s|
+ s.write "plugins.rb"
+ end
+ end
+
+ it "prints a deprecation warning", bundler: "< 3" do
+ bundle "plugin install foo --local_git #{lib_path("foo-1.0")}"
+
+ expect(out).to include("Installed plugin foo")
+ expect(deprecations).to include "--local_git is deprecated, use --git"
+ end
+
+ pending "fails with a helpful message", bundler: "3"
+ end
+
+ describe "deprecating rubocop" do
+ before do
+ global_config "BUNDLE_GEM__MIT" => "false", "BUNDLE_GEM__TEST" => "false", "BUNDLE_GEM__COC" => "false",
+ "BUNDLE_GEM__CI" => "false", "BUNDLE_GEM__CHANGELOG" => "false"
+ end
+
context "bundle gem --rubocop" do
before do
- bundle "gem my_new_gem --rubocop", :raise_on_error => false
+ bundle "gem my_new_gem --rubocop", raise_on_error: false
end
- it "prints a deprecation warning", :bundler => "< 3" do
+ it "prints a deprecation warning", bundler: "< 3" do
expect(deprecations).to include \
"--rubocop is deprecated, use --linter=rubocop"
end
@@ -616,10 +637,10 @@ RSpec.describe "major deprecations" do
context "bundle gem --no-rubocop" do
before do
- bundle "gem my_new_gem --no-rubocop", :raise_on_error => false
+ bundle "gem my_new_gem --no-rubocop", raise_on_error: false
end
- it "prints a deprecation warning", :bundler => "< 3" do
+ it "prints a deprecation warning", bundler: "< 3" do
expect(deprecations).to include \
"--no-rubocop is deprecated, use --linter"
end
@@ -627,10 +648,10 @@ RSpec.describe "major deprecations" do
context "bundle gem with gem.rubocop set to true" do
before do
- bundle "gem my_new_gem", :env => { "BUNDLE_GEM__RUBOCOP" => "true" }, :raise_on_error => false
+ bundle "gem my_new_gem", env: { "BUNDLE_GEM__RUBOCOP" => "true" }, raise_on_error: false
end
- it "prints a deprecation warning", :bundler => "< 3" do
+ it "prints a deprecation warning", bundler: "< 3" do
expect(deprecations).to include \
"config gem.rubocop is deprecated; we've updated your config to use gem.linter instead"
end
@@ -638,10 +659,10 @@ RSpec.describe "major deprecations" do
context "bundle gem with gem.rubocop set to false" do
before do
- bundle "gem my_new_gem", :env => { "BUNDLE_GEM__RUBOCOP" => "false" }, :raise_on_error => false
+ bundle "gem my_new_gem", env: { "BUNDLE_GEM__RUBOCOP" => "false" }, raise_on_error: false
end
- it "prints a deprecation warning", :bundler => "< 3" do
+ it "prints a deprecation warning", bundler: "< 3" do
expect(deprecations).to include \
"config gem.rubocop is deprecated; we've updated your config to use gem.linter instead"
end
diff --git a/spec/bundler/other/platform_spec.rb b/spec/bundler/other/platform_spec.rb
deleted file mode 100644
index bf38a05646..0000000000
--- a/spec/bundler/other/platform_spec.rb
+++ /dev/null
@@ -1,1288 +0,0 @@
-# frozen_string_literal: true
-
-RSpec.describe "bundle platform" do
- context "without flags" do
- let(:bundle_platform_platforms_string) do
- local_platforms.reverse.map {|pl| "* #{pl}" }.join("\n")
- end
-
- it "returns all the output" do
- gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
-
- #{ruby_version_correct}
-
- gem "foo"
- G
-
- bundle "platform"
- expect(out).to eq(<<-G.chomp)
-Your platform is: #{Gem::Platform.local}
-
-Your app has gems that work on these platforms:
-#{bundle_platform_platforms_string}
-
-Your Gemfile specifies a Ruby version requirement:
-* ruby #{RUBY_VERSION}
-
-Your current platform satisfies the Ruby version requirement.
-G
- end
-
- it "returns all the output including the patchlevel" do
- gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
-
- #{ruby_version_correct_patchlevel}
-
- gem "foo"
- G
-
- bundle "platform"
- expect(out).to eq(<<-G.chomp)
-Your platform is: #{Gem::Platform.local}
-
-Your app has gems that work on these platforms:
-#{bundle_platform_platforms_string}
-
-Your Gemfile specifies a Ruby version requirement:
-* ruby #{RUBY_VERSION}p#{RUBY_PATCHLEVEL}
-
-Your current platform satisfies the Ruby version requirement.
-G
- end
-
- it "doesn't print ruby version requirement if it isn't specified" do
- gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
-
- gem "foo"
- G
-
- bundle "platform"
- expect(out).to eq(<<-G.chomp)
-Your platform is: #{Gem::Platform.local}
-
-Your app has gems that work on these platforms:
-#{bundle_platform_platforms_string}
-
-Your Gemfile does not specify a Ruby version requirement.
-G
- end
-
- it "doesn't match the ruby version requirement" do
- gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
-
- #{ruby_version_incorrect}
-
- gem "foo"
- G
-
- bundle "platform"
- expect(out).to eq(<<-G.chomp)
-Your platform is: #{Gem::Platform.local}
-
-Your app has gems that work on these platforms:
-#{bundle_platform_platforms_string}
-
-Your Gemfile specifies a Ruby version requirement:
-* ruby #{not_local_ruby_version}
-
-Your Ruby version is #{RUBY_VERSION}, but your Gemfile specified #{not_local_ruby_version}
-G
- end
- end
-
- context "--ruby" do
- it "returns ruby version when explicit" do
- gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- ruby "1.9.3", :engine => 'ruby', :engine_version => '1.9.3'
-
- gem "foo"
- G
-
- bundle "platform --ruby"
-
- expect(out).to eq("ruby 1.9.3")
- end
-
- it "defaults to MRI" do
- gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- ruby "1.9.3"
-
- gem "foo"
- G
-
- bundle "platform --ruby"
-
- expect(out).to eq("ruby 1.9.3")
- end
-
- it "handles jruby" do
- gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- ruby "1.8.7", :engine => 'jruby', :engine_version => '1.6.5'
-
- gem "foo"
- G
-
- bundle "platform --ruby"
-
- expect(out).to eq("ruby 1.8.7 (jruby 1.6.5)")
- end
-
- it "handles rbx" do
- gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- ruby "1.8.7", :engine => 'rbx', :engine_version => '1.2.4'
-
- gem "foo"
- G
-
- bundle "platform --ruby"
-
- expect(out).to eq("ruby 1.8.7 (rbx 1.2.4)")
- end
-
- it "handles truffleruby" do
- gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- ruby "2.5.1", :engine => 'truffleruby', :engine_version => '1.0.0-rc6'
-
- gem "foo"
- G
-
- bundle "platform --ruby"
-
- expect(out).to eq("ruby 2.5.1 (truffleruby 1.0.0-rc6)")
- end
-
- it "raises an error if engine is used but engine version is not" do
- gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- ruby "1.8.7", :engine => 'rbx'
-
- gem "foo"
- G
-
- bundle "platform", :raise_on_error => false
-
- expect(exitstatus).not_to eq(0)
- end
-
- it "raises an error if engine_version is used but engine is not" do
- gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- ruby "1.8.7", :engine_version => '1.2.4'
-
- gem "foo"
- G
-
- bundle "platform", :raise_on_error => false
-
- expect(exitstatus).not_to eq(0)
- end
-
- it "raises an error if engine version doesn't match ruby version for MRI" do
- gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- ruby "1.8.7", :engine => 'ruby', :engine_version => '1.2.4'
-
- gem "foo"
- G
-
- bundle "platform", :raise_on_error => false
-
- expect(exitstatus).not_to eq(0)
- end
-
- it "should print if no ruby version is specified" do
- gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
-
- gem "foo"
- G
-
- bundle "platform --ruby"
-
- expect(out).to eq("No ruby version specified")
- end
-
- it "handles when there is a locked requirement" do
- gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- ruby "< 1.8.7"
- G
-
- lockfile <<-L
- GEM
- remote: #{file_uri_for(gem_repo1)}/
- specs:
-
- PLATFORMS
- ruby
-
- DEPENDENCIES
-
- RUBY VERSION
- ruby 1.0.0p127
-
- BUNDLED WITH
- #{Bundler::VERSION}
- L
-
- bundle "platform --ruby"
- expect(out).to eq("ruby 1.0.0p127")
- end
-
- it "handles when there is a requirement in the gemfile" do
- gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- ruby ">= 1.8.7"
- G
-
- bundle "platform --ruby"
- expect(out).to eq("ruby 1.8.7")
- end
-
- it "handles when there are multiple requirements in the gemfile" do
- gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- ruby ">= 1.8.7", "< 2.0.0"
- G
-
- bundle "platform --ruby"
- expect(out).to eq("ruby 1.8.7")
- end
- end
-
- let(:ruby_version_correct) { "ruby \"#{RUBY_VERSION}\", :engine => \"#{local_ruby_engine}\", :engine_version => \"#{local_engine_version}\"" }
- let(:ruby_version_correct_engineless) { "ruby \"#{RUBY_VERSION}\"" }
- let(:ruby_version_correct_patchlevel) { "#{ruby_version_correct}, :patchlevel => '#{RUBY_PATCHLEVEL}'" }
- let(:ruby_version_incorrect) { "ruby \"#{not_local_ruby_version}\", :engine => \"#{local_ruby_engine}\", :engine_version => \"#{not_local_ruby_version}\"" }
- let(:engine_incorrect) { "ruby \"#{RUBY_VERSION}\", :engine => \"#{not_local_tag}\", :engine_version => \"#{RUBY_VERSION}\"" }
- let(:engine_version_incorrect) { "ruby \"#{RUBY_VERSION}\", :engine => \"#{local_ruby_engine}\", :engine_version => \"#{not_local_engine_version}\"" }
- let(:patchlevel_incorrect) { "#{ruby_version_correct}, :patchlevel => '#{not_local_patchlevel}'" }
- let(:patchlevel_fixnum) { "#{ruby_version_correct}, :patchlevel => #{RUBY_PATCHLEVEL}1" }
-
- def should_be_ruby_version_incorrect
- expect(exitstatus).to eq(18)
- expect(err).to be_include("Your Ruby version is #{RUBY_VERSION}, but your Gemfile specified #{not_local_ruby_version}")
- end
-
- def should_be_engine_incorrect
- expect(exitstatus).to eq(18)
- expect(err).to be_include("Your Ruby engine is #{local_ruby_engine}, but your Gemfile specified #{not_local_tag}")
- end
-
- def should_be_engine_version_incorrect
- expect(exitstatus).to eq(18)
- expect(err).to be_include("Your #{local_ruby_engine} version is #{local_engine_version}, but your Gemfile specified #{local_ruby_engine} #{not_local_engine_version}")
- end
-
- def should_be_patchlevel_incorrect
- expect(exitstatus).to eq(18)
- expect(err).to be_include("Your Ruby patchlevel is #{RUBY_PATCHLEVEL}, but your Gemfile specified #{not_local_patchlevel}")
- end
-
- def should_be_patchlevel_fixnum
- expect(exitstatus).to eq(18)
- expect(err).to be_include("The Ruby patchlevel in your Gemfile must be a string")
- end
-
- context "bundle install" do
- it "installs fine when the ruby version matches" do
- install_gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- gem "rack"
-
- #{ruby_version_correct}
- G
-
- expect(bundled_app_lock).to exist
- end
-
- it "installs fine with any engine", :jruby do
- install_gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- gem "rack"
-
- #{ruby_version_correct_engineless}
- G
-
- expect(bundled_app_lock).to exist
- end
-
- it "installs fine when the patchlevel matches" do
- install_gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- gem "rack"
-
- #{ruby_version_correct_patchlevel}
- G
-
- expect(bundled_app_lock).to exist
- end
-
- it "doesn't install when the ruby version doesn't match" do
- install_gemfile <<-G, :raise_on_error => false
- source "#{file_uri_for(gem_repo1)}"
- gem "rack"
-
- #{ruby_version_incorrect}
- G
-
- expect(bundled_app_lock).not_to exist
- should_be_ruby_version_incorrect
- end
-
- it "doesn't install when engine doesn't match" do
- install_gemfile <<-G, :raise_on_error => false
- source "#{file_uri_for(gem_repo1)}"
- gem "rack"
-
- #{engine_incorrect}
- G
-
- expect(bundled_app_lock).not_to exist
- should_be_engine_incorrect
- end
-
- it "doesn't install when engine version doesn't match", :jruby do
- install_gemfile <<-G, :raise_on_error => false
- source "#{file_uri_for(gem_repo1)}"
- gem "rack"
-
- #{engine_version_incorrect}
- G
-
- expect(bundled_app_lock).not_to exist
- should_be_engine_version_incorrect
- end
-
- it "doesn't install when patchlevel doesn't match" do
- install_gemfile <<-G, :raise_on_error => false
- source "#{file_uri_for(gem_repo1)}"
- gem "rack"
-
- #{patchlevel_incorrect}
- G
-
- expect(bundled_app_lock).not_to exist
- should_be_patchlevel_incorrect
- end
- end
-
- context "bundle check" do
- it "checks fine when the ruby version matches" do
- install_gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- gem "rack"
- G
-
- gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- gem "rack"
-
- #{ruby_version_correct}
- G
-
- bundle :check
- expect(out).to match(/\AResolving dependencies\.\.\.\.*\nThe Gemfile's dependencies are satisfied\z/)
- end
-
- it "checks fine with any engine", :jruby do
- install_gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- gem "rack"
- G
-
- gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- gem "rack"
-
- #{ruby_version_correct_engineless}
- G
-
- bundle :check
- expect(out).to match(/\AResolving dependencies\.\.\.\.*\nThe Gemfile's dependencies are satisfied\z/)
- end
-
- it "fails when ruby version doesn't match" do
- install_gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- gem "rack"
- G
-
- gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- gem "rack"
-
- #{ruby_version_incorrect}
- G
-
- bundle :check, :raise_on_error => false
- should_be_ruby_version_incorrect
- end
-
- it "fails when engine doesn't match" do
- install_gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- gem "rack"
- G
-
- gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- gem "rack"
-
- #{engine_incorrect}
- G
-
- bundle :check, :raise_on_error => false
- should_be_engine_incorrect
- end
-
- it "fails when engine version doesn't match", :jruby do
- install_gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- gem "rack"
- G
-
- gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- gem "rack"
-
- #{engine_version_incorrect}
- G
-
- bundle :check, :raise_on_error => false
- should_be_engine_version_incorrect
- end
-
- it "fails when patchlevel doesn't match" do
- install_gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- gem "rack"
- G
-
- gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- gem "rack"
-
- #{patchlevel_incorrect}
- G
-
- bundle :check, :raise_on_error => false
- should_be_patchlevel_incorrect
- end
- end
-
- context "bundle update" do
- before do
- build_repo2
-
- install_gemfile <<-G
- source "#{file_uri_for(gem_repo2)}"
- gem "activesupport"
- gem "rack-obama"
- G
- end
-
- it "updates successfully when the ruby version matches" do
- gemfile <<-G
- source "#{file_uri_for(gem_repo2)}"
- gem "activesupport"
- gem "rack-obama"
-
- #{ruby_version_correct}
- G
- update_repo2 do
- build_gem "rack", "1.2" do |s|
- s.executables = "rackup"
- end
-
- build_gem "activesupport", "3.0"
- end
-
- bundle "update", :all => true
- expect(the_bundle).to include_gems "rack 1.2", "rack-obama 1.0", "activesupport 3.0"
- end
-
- it "updates fine with any engine", :jruby do
- gemfile <<-G
- source "#{file_uri_for(gem_repo2)}"
- gem "activesupport"
- gem "rack-obama"
-
- #{ruby_version_correct_engineless}
- G
- update_repo2 do
- build_gem "rack", "1.2" do |s|
- s.executables = "rackup"
- end
-
- build_gem "activesupport", "3.0"
- end
-
- bundle "update", :all => true
- expect(the_bundle).to include_gems "rack 1.2", "rack-obama 1.0", "activesupport 3.0"
- end
-
- it "fails when ruby version doesn't match" do
- gemfile <<-G
- source "#{file_uri_for(gem_repo2)}"
- gem "activesupport"
- gem "rack-obama"
-
- #{ruby_version_incorrect}
- G
- update_repo2 do
- build_gem "activesupport", "3.0"
- end
-
- bundle :update, :all => true, :raise_on_error => false
- should_be_ruby_version_incorrect
- end
-
- it "fails when ruby engine doesn't match", :jruby do
- gemfile <<-G
- source "#{file_uri_for(gem_repo2)}"
- gem "activesupport"
- gem "rack-obama"
-
- #{engine_incorrect}
- G
- update_repo2 do
- build_gem "activesupport", "3.0"
- end
-
- bundle :update, :all => true, :raise_on_error => false
- should_be_engine_incorrect
- end
-
- it "fails when ruby engine version doesn't match", :jruby do
- gemfile <<-G
- source "#{file_uri_for(gem_repo2)}"
- gem "activesupport"
- gem "rack-obama"
-
- #{engine_version_incorrect}
- G
- update_repo2 do
- build_gem "activesupport", "3.0"
- end
-
- bundle :update, :all => true, :raise_on_error => false
- should_be_engine_version_incorrect
- end
-
- it "fails when patchlevel doesn't match" do
- gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- gem "rack"
-
- #{patchlevel_incorrect}
- G
- update_repo2 do
- build_gem "activesupport", "3.0"
- end
-
- bundle :update, :all => true, :raise_on_error => false
- should_be_patchlevel_incorrect
- end
- end
-
- context "bundle info" do
- before do
- install_gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- gem "rails"
- G
- end
-
- it "prints path if ruby version is correct" do
- install_gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- gem "rails"
-
- #{ruby_version_correct}
- G
-
- bundle "info rails --path"
- expect(out).to eq(default_bundle_path("gems", "rails-2.3.2").to_s)
- end
-
- it "prints path if ruby version is correct for any engine", :jruby do
- install_gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- gem "rails"
-
- #{ruby_version_correct_engineless}
- G
-
- bundle "info rails --path"
- 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
- gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- gem "rails"
-
- #{ruby_version_incorrect}
- G
-
- bundle "show rails", :raise_on_error => false
- should_be_ruby_version_incorrect
- end
-
- it "fails if engine doesn't match", :bundler => "< 3" do
- gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- gem "rails"
-
- #{engine_incorrect}
- G
-
- bundle "show rails", :raise_on_error => false
- should_be_engine_incorrect
- end
-
- it "fails if engine version doesn't match", :bundler => "< 3", :jruby => true do
- gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- gem "rails"
-
- #{engine_version_incorrect}
- G
-
- bundle "show rails", :raise_on_error => false
- should_be_engine_version_incorrect
- end
-
- it "fails when patchlevel doesn't match", :bundler => "< 3" do
- gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- gem "rack"
-
- #{patchlevel_incorrect}
- G
- update_repo2 do
- build_gem "activesupport", "3.0"
- end
-
- bundle "show rails", :raise_on_error => false
- should_be_patchlevel_incorrect
- end
- end
-
- context "bundle cache" do
- before do
- install_gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- gem 'rack'
- G
- end
-
- it "copies the .gem file to vendor/cache when ruby version matches" do
- gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- gem 'rack'
-
- #{ruby_version_correct}
- G
-
- bundle :cache
- expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist
- end
-
- it "copies the .gem file to vendor/cache when ruby version matches for any engine", :jruby do
- install_gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- gem 'rack'
-
- #{ruby_version_correct_engineless}
- G
-
- bundle :cache
- expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist
- end
-
- it "fails if the ruby version doesn't match" do
- gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- gem 'rack'
-
- #{ruby_version_incorrect}
- G
-
- bundle :cache, :raise_on_error => false
- should_be_ruby_version_incorrect
- end
-
- it "fails if the engine doesn't match" do
- gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- gem 'rack'
-
- #{engine_incorrect}
- G
-
- bundle :cache, :raise_on_error => false
- should_be_engine_incorrect
- end
-
- it "fails if the engine version doesn't match", :jruby do
- gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- gem 'rack'
-
- #{engine_version_incorrect}
- G
-
- bundle :cache, :raise_on_error => false
- should_be_engine_version_incorrect
- end
-
- it "fails when patchlevel doesn't match" do
- gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- gem "rack"
-
- #{patchlevel_incorrect}
- G
-
- bundle :cache, :raise_on_error => false
- should_be_patchlevel_incorrect
- end
- end
-
- context "bundle pack" do
- before do
- install_gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- gem 'rack'
- G
- end
-
- it "copies the .gem file to vendor/cache when ruby version matches" do
- gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- gem 'rack'
-
- #{ruby_version_correct}
- G
-
- bundle :cache
- expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist
- end
-
- it "copies the .gem file to vendor/cache when ruby version matches any engine", :jruby do
- install_gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- gem 'rack'
-
- #{ruby_version_correct_engineless}
- G
-
- bundle :cache
- expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist
- end
-
- it "fails if the ruby version doesn't match" do
- gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- gem 'rack'
-
- #{ruby_version_incorrect}
- G
-
- bundle :cache, :raise_on_error => false
- should_be_ruby_version_incorrect
- end
-
- it "fails if the engine doesn't match" do
- gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- gem 'rack'
-
- #{engine_incorrect}
- G
-
- bundle :cache, :raise_on_error => false
- should_be_engine_incorrect
- end
-
- it "fails if the engine version doesn't match", :jruby do
- gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- gem 'rack'
-
- #{engine_version_incorrect}
- G
-
- bundle :cache, :raise_on_error => false
- should_be_engine_version_incorrect
- end
-
- it "fails when patchlevel doesn't match" do
- gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- gem "rack"
-
- #{patchlevel_incorrect}
- G
-
- bundle :cache, :raise_on_error => false
- should_be_patchlevel_incorrect
- end
- end
-
- 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
- end
-
- it "activates the correct gem when ruby version matches" do
- gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- gem "rack", "0.9.1"
-
- #{ruby_version_correct}
- G
-
- bundle "exec rackup"
- expect(out).to include("0.9.1")
- end
-
- it "activates the correct gem when ruby version matches any engine", :jruby do
- 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"
-
- #{ruby_version_correct_engineless}
- G
-
- bundle "exec rackup"
- expect(out).to include("0.9.1")
- end
-
- it "fails when the ruby version doesn't match" do
- gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- gem "rack", "0.9.1"
-
- #{ruby_version_incorrect}
- G
-
- bundle "exec rackup", :raise_on_error => false
- should_be_ruby_version_incorrect
- end
-
- it "fails when the engine doesn't match" do
- gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- gem "rack", "0.9.1"
-
- #{engine_incorrect}
- G
-
- bundle "exec rackup", :raise_on_error => false
- should_be_engine_incorrect
- end
-
- # it "fails when the engine version doesn't match", :jruby do
- # gemfile <<-G
- # gem "rack", "0.9.1"
- #
- # #{engine_version_incorrect}
- # G
- #
- # bundle "exec rackup"
- # should_be_engine_version_incorrect
- # end
-
- it "fails when patchlevel doesn't match" do
- gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- gem "rack"
-
- #{patchlevel_incorrect}
- G
-
- bundle "exec rackup", :raise_on_error => false
- should_be_patchlevel_incorrect
- end
- end
-
- context "bundle console", :bundler => "< 3" do
- before do
- install_gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- gem "rack"
- gem "activesupport", :group => :test
- gem "rack_middleware", :group => :development
- G
- end
-
- it "starts IRB with the default group loaded when ruby version matches", :readline do
- gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- gem "rack"
- gem "activesupport", :group => :test
- gem "rack_middleware", :group => :development
-
- #{ruby_version_correct}
- G
-
- bundle "console" do |input, _, _|
- input.puts("puts RACK")
- input.puts("exit")
- end
- expect(out).to include("0.9.1")
- end
-
- it "starts IRB with the default group loaded when ruby version matches", :readline, :jruby do
- gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- gem "rack"
- gem "activesupport", :group => :test
- gem "rack_middleware", :group => :development
-
- #{ruby_version_correct_engineless}
- G
-
- bundle "console" do |input, _, _|
- input.puts("puts RACK")
- input.puts("exit")
- end
- expect(out).to include("0.9.1")
- end
-
- it "fails when ruby version doesn't match" do
- gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- gem "rack"
- gem "activesupport", :group => :test
- gem "rack_middleware", :group => :development
-
- #{ruby_version_incorrect}
- G
-
- bundle "console", :raise_on_error => false
- should_be_ruby_version_incorrect
- end
-
- it "fails when engine doesn't match" do
- gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- gem "rack"
- gem "activesupport", :group => :test
- gem "rack_middleware", :group => :development
-
- #{engine_incorrect}
- G
-
- bundle "console", :raise_on_error => false
- should_be_engine_incorrect
- end
-
- it "fails when engine version doesn't match", :jruby do
- gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- gem "rack"
- gem "activesupport", :group => :test
- gem "rack_middleware", :group => :development
-
- #{engine_version_incorrect}
- G
-
- bundle "console", :raise_on_error => false
- should_be_engine_version_incorrect
- end
-
- it "fails when patchlevel doesn't match" do
- gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- gem "rack"
- gem "activesupport", :group => :test
- gem "rack_middleware", :group => :development
-
- #{patchlevel_incorrect}
- G
-
- bundle "console", :raise_on_error => false
- should_be_patchlevel_incorrect
- end
- end
-
- context "Bundler.setup" do
- before do
- install_gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- gem "yard"
- gem "rack", :group => :test
- G
-
- ENV["BUNDLER_FORCE_TTY"] = "true"
- end
-
- it "makes a Gemfile.lock if setup succeeds" do
- install_gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- gem "yard"
- gem "rack"
-
- #{ruby_version_correct}
- G
-
- FileUtils.rm(bundled_app_lock)
-
- run "1"
- expect(bundled_app_lock).to exist
- end
-
- it "makes a Gemfile.lock if setup succeeds for any engine", :jruby do
- install_gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- gem "yard"
- gem "rack"
-
- #{ruby_version_correct_engineless}
- G
-
- FileUtils.rm(bundled_app_lock)
-
- run "1"
- expect(bundled_app_lock).to exist
- end
-
- it "fails when ruby version doesn't match" do
- install_gemfile <<-G, :raise_on_error => false
- source "#{file_uri_for(gem_repo1)}"
- gem "yard"
- gem "rack"
-
- #{ruby_version_incorrect}
- G
-
- FileUtils.rm(bundled_app_lock)
-
- 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
- source "#{file_uri_for(gem_repo1)}"
- gem "yard"
- gem "rack"
-
- #{engine_incorrect}
- G
-
- FileUtils.rm(bundled_app_lock)
-
- 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 do
- install_gemfile <<-G, :raise_on_error => false
- source "#{file_uri_for(gem_repo1)}"
- gem "yard"
- gem "rack"
-
- #{engine_version_incorrect}
- G
-
- FileUtils.rm(bundled_app_lock)
-
- 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
- source "#{file_uri_for(gem_repo1)}"
- gem "yard"
- gem "rack"
-
- #{patchlevel_incorrect}
- G
-
- FileUtils.rm(bundled_app_lock)
-
- ruby "require 'bundler/setup'", :env => { "BUNDLER_VERSION" => Bundler::VERSION }, :raise_on_error => false
-
- expect(bundled_app_lock).not_to exist
- should_be_patchlevel_incorrect
- end
- end
-
- context "bundle outdated" do
- before do
- build_repo2 do
- build_git "foo", :path => lib_path("foo")
- end
-
- install_gemfile <<-G
- source "#{file_uri_for(gem_repo2)}"
- gem "activesupport", "2.3.5"
- gem "foo", :git => "#{lib_path("foo")}"
- G
- end
-
- 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")
- end
-
- gemfile <<-G
- source "#{file_uri_for(gem_repo2)}"
- gem "activesupport", "2.3.5"
- gem "foo", :git => "#{lib_path("foo")}"
-
- #{ruby_version_correct}
- G
-
- bundle "outdated", :raise_on_error => false
-
- expected_output = <<~TABLE.gsub("x", "\\\h").tr(".", "\.").strip
- Gem Current Latest Requested Groups
- activesupport 2.3.5 3.0 = 2.3.5 default
- foo 1.0 xxxxxxx 1.0 xxxxxxx >= 0 default
- TABLE
-
- expect(out).to match(Regexp.new(expected_output))
- end
-
- it "returns list of outdated gems when the ruby version matches for any engine", :jruby do
- bundle :install
- update_repo2 do
- build_gem "activesupport", "3.0"
- update_git "foo", :path => lib_path("foo")
- end
-
- gemfile <<-G
- source "#{file_uri_for(gem_repo2)}"
- gem "activesupport", "2.3.5"
- gem "foo", :git => "#{lib_path("foo")}"
-
- #{ruby_version_correct_engineless}
- G
-
- bundle "outdated", :raise_on_error => false
-
- expected_output = <<~TABLE.gsub("x", "\\\h").tr(".", "\.").strip
- Gem Current Latest Requested Groups
- activesupport 2.3.5 3.0 = 2.3.5 default
- foo 1.0 xxxxxxx 1.0 xxxxxxx >= 0 default
- TABLE
-
- expect(out).to match(Regexp.new(expected_output))
- end
-
- 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")
- end
-
- gemfile <<-G
- source "#{file_uri_for(gem_repo2)}"
- gem "activesupport", "2.3.5"
- gem "foo", :git => "#{lib_path("foo")}"
-
- #{ruby_version_incorrect}
- G
-
- 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")
- end
-
- gemfile <<-G
- source "#{file_uri_for(gem_repo2)}"
- gem "activesupport", "2.3.5"
- gem "foo", :git => "#{lib_path("foo")}"
-
- #{engine_incorrect}
- G
-
- bundle "outdated", :raise_on_error => false
- should_be_engine_incorrect
- end
-
- it "fails when the engine version doesn't match", :jruby do
- update_repo2 do
- build_gem "activesupport", "3.0"
- update_git "foo", :path => lib_path("foo")
- end
-
- gemfile <<-G
- source "#{file_uri_for(gem_repo2)}"
- gem "activesupport", "2.3.5"
- gem "foo", :git => "#{lib_path("foo")}"
-
- #{engine_version_incorrect}
- G
-
- bundle "outdated", :raise_on_error => false
- should_be_engine_version_incorrect
- end
-
- it "fails when the patchlevel doesn't match", :jruby do
- update_repo2 do
- build_gem "activesupport", "3.0"
- update_git "foo", :path => lib_path("foo")
- end
-
- gemfile <<-G
- source "#{file_uri_for(gem_repo2)}"
- gem "activesupport", "2.3.5"
- gem "foo", :git => "#{lib_path("foo")}"
-
- #{patchlevel_incorrect}
- G
-
- bundle "outdated", :raise_on_error => false
- should_be_patchlevel_incorrect
- end
-
- it "fails when the patchlevel is a fixnum", :jruby do
- update_repo2 do
- build_gem "activesupport", "3.0"
- update_git "foo", :path => lib_path("foo")
- end
-
- gemfile <<-G
- source "#{file_uri_for(gem_repo2)}"
- gem "activesupport", "2.3.5"
- gem "foo", :git => "#{lib_path("foo")}"
-
- #{patchlevel_fixnum}
- G
-
- bundle "outdated", :raise_on_error => false
- should_be_patchlevel_fixnum
- end
- end
-end