summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColby Swandale <me@colby.fyi>2018-10-11 20:39:57 +1100
committerColby Swandale <me@colby.fyi>2018-10-12 15:49:31 +1100
commit4418d1b7147fb62b3cd100cb9f7f6811d9922503 (patch)
tree51c5c66460c850e0408ee323a9d5c612f2ead3d3
parent35200ec337399b3cf411136ed90b3f86181ad68a (diff)
downloadbundler-4418d1b7147fb62b3cd100cb9f7f6811d9922503.tar.gz
scope specs testing bundler 2 deprecations to bundler 1 only
-rw-r--r--spec/commands/show_spec.rb86
-rw-r--r--spec/install/redownload_spec.rb18
-rw-r--r--spec/update/redownload_spec.rb18
3 files changed, 55 insertions, 67 deletions
diff --git a/spec/commands/show_spec.rb b/spec/commands/show_spec.rb
index 17315740df..efbe4b13fb 100644
--- a/spec/commands/show_spec.rb
+++ b/spec/commands/show_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-RSpec.describe "bundle show" do
+RSpec.describe "bundle show", :bundler => "< 2", :ruby => ">= 2.0" do
context "with a standard Gemfile" do
before :each do
install_gemfile <<-G
@@ -25,30 +25,56 @@ RSpec.describe "bundle show" do
expect(bundled_app("Gemfile.lock")).to exist
end
- it "prints path if gem exists in bundle", :bundler => "< 2" do
+ it "prints path if gem exists in bundle" do
bundle "show rails"
expect(out).to eq(default_bundle_path("gems", "rails-2.3.2").to_s)
end
- it "prints path if gem exists in bundle", :bundler => "2" do
- bundle "show rails"
- expect(out).to eq(
- "[DEPRECATED FOR 2.0] use `bundle info rails` instead of `bundle show rails`\n" +
- default_bundle_path("gems", "rails-2.3.2").to_s
- )
- end
+ context "when show command deprecation is enabled" do
+ before { bundle "config major_deprecations yes" }
- it "prints path if gem exists in bundle (with --paths option)", :bundler => "< 2" do
- bundle "show rails --paths"
- expect(out).to eq(default_bundle_path("gems", "rails-2.3.2").to_s)
+ it "prints path if gem exists in bundle" do
+ bundle "show rails"
+ expect(out).to eq(
+ "[DEPRECATED FOR 2.0] use `bundle info rails` instead of `bundle show rails`\n" +
+ default_bundle_path("gems", "rails-2.3.2").to_s
+ )
+ end
+
+ it "prints the path to the running bundler" do
+ bundle "show bundler"
+ expect(out).to eq(
+ "[DEPRECATED FOR 2.0] use `bundle info bundler` instead of `bundle show bundler`\n" +
+ root.to_s
+ )
+ end
+
+ it "prints path if gem exists in bundle (with --paths option)" do
+ bundle "show rails --paths"
+ expect(out).to eq(
+ "[DEPRECATED FOR 2.0] use `bundle info rails --path` instead of `bundle show rails --paths`\n" +
+ default_bundle_path("gems", "rails-2.3.2").to_s
+ )
+ end
+
+ it "prints path of all gems in bundle sorted by name" do
+ bundle "show --paths"
+
+ expect(out).to include(default_bundle_path("gems", "rake-10.0.2").to_s)
+ expect(out).to include(default_bundle_path("gems", "rails-2.3.2").to_s)
+
+ out_lines = out.split("\n")
+ expect(out_lines[0]).to eq("[DEPRECATED FOR 2.0] use `bundle list` instead of `bundle show --paths`")
+
+ # Gem names are the last component of their path.
+ gem_list = out_lines[1..-1].map {|p| p.split("/").last }
+ expect(gem_list).to eq(gem_list.sort)
+ end
end
- it "prints path if gem exists in bundle (with --paths option)", :bundler => "2" do
+ it "prints path if gem exists in bundle (with --paths option)" do
bundle "show rails --paths"
- expect(out).to eq(
- "[DEPRECATED FOR 2.0] use `bundle info rails --path` instead of `bundle show rails --paths`\n" +
- default_bundle_path("gems", "rails-2.3.2").to_s
- )
+ expect(out).to eq(default_bundle_path("gems", "rails-2.3.2").to_s)
end
it "warns if path no longer exists on disk" do
@@ -60,25 +86,17 @@ RSpec.describe "bundle show" do
and include(default_bundle_path("gems", "rails-2.3.2").to_s)
end
- it "prints the path to the running bundler", :bundler => "< 2" do
+ it "prints the path to the running bundler" do
bundle "show bundler"
expect(out).to eq(root.to_s)
end
- it "prints the path to the running bundler", :bundler => "2" do
- bundle "show bundler"
- expect(out).to eq(
- "[DEPRECATED FOR 2.0] use `bundle info bundler` instead of `bundle show bundler`\n" +
- root.to_s
- )
- end
-
it "complains if gem not in bundle" do
bundle "show missing"
expect(out).to match(/could not find gem 'missing'/i)
end
- it "prints path of all gems in bundle sorted by name", :bundler => "< 2" do
+ it "prints path of all gems in bundle sorted by name" do
bundle "show --paths"
expect(out).to include(default_bundle_path("gems", "rake-10.0.2").to_s)
@@ -89,20 +107,6 @@ RSpec.describe "bundle show" do
expect(gem_list).to eq(gem_list.sort)
end
- it "prints path of all gems in bundle sorted by name", :bundler => "2" do
- bundle "show --paths"
-
- expect(out).to include(default_bundle_path("gems", "rake-10.0.2").to_s)
- expect(out).to include(default_bundle_path("gems", "rails-2.3.2").to_s)
-
- out_lines = out.split("\n")
- expect(out_lines[0]).to eq("[DEPRECATED FOR 2.0] use `bundle list` instead of `bundle show --paths`")
-
- # Gem names are the last component of their path.
- gem_list = out_lines[1..-1].map {|p| p.split("/").last }
- expect(gem_list).to eq(gem_list.sort)
- end
-
it "prints summary of gems" do
bundle "show --verbose"
diff --git a/spec/install/redownload_spec.rb b/spec/install/redownload_spec.rb
index 232c0f9e2c..665c64d49a 100644
--- a/spec/install/redownload_spec.rb
+++ b/spec/install/redownload_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-RSpec.describe "bundle install" do
+RSpec.describe "bundle install", :bundler => "< 2", :ruby => ">= 2.0" do
before :each do
gemfile <<-G
source "file://#{gem_repo1}"
@@ -8,6 +8,8 @@ RSpec.describe "bundle install" do
G
end
+ before { bundle "config major_deprecations yes" }
+
shared_examples_for "an option to force redownloading gems" do
it "re-installs installed gems" do
rack_lib = default_bundle_path("gems/rack-1.0.0/lib/rack.rb")
@@ -61,25 +63,15 @@ RSpec.describe "bundle install" do
let(:flag) { "force" }
end
- it "shows a deprecation when single flag passed", :bundler => 2 do
+ it "shows a deprecation when single flag passed" do
bundle! "install --force"
expect(out).to include "[DEPRECATED FOR 2.0] The `--force` option has been renamed to `--redownload`"
end
- it "shows a deprecation when multiple flags passed", :bundler => 2 do
+ it "shows a deprecation when multiple flags passed" do
bundle! "install --no-color --force"
expect(out).to include "[DEPRECATED FOR 2.0] The `--force` option has been renamed to `--redownload`"
end
-
- it "does not show a deprecation when single flag passed", :bundler => "< 2" do
- bundle! "install --force"
- expect(out).not_to include "[DEPRECATED FOR 2.0] The `--force` option has been renamed to `--redownload`"
- end
-
- it "does not show a deprecation when multiple flags passed", :bundler => "< 2" do
- bundle! "install --no-color --force"
- expect(out).not_to include "[DEPRECATED FOR 2.0] The `--force` option has been renamed to `--redownload`"
- end
end
describe "with --redownload" do
diff --git a/spec/update/redownload_spec.rb b/spec/update/redownload_spec.rb
index 5a739c51b3..018d3ed2e9 100644
--- a/spec/update/redownload_spec.rb
+++ b/spec/update/redownload_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-RSpec.describe "bundle update" do
+RSpec.describe "bundle update", :bundler => "< 2", :ruby => ">= 2.0" do
before :each do
install_gemfile <<-G
source "file://#{gem_repo1}"
@@ -8,26 +8,18 @@ RSpec.describe "bundle update" do
G
end
+ before { bundle "config major_deprecations yes" }
+
describe "with --force" do
- it "shows a deprecation when single flag passed", :bundler => 2 do
+ it "shows a deprecation when single flag passed" do
bundle! "update rack --force"
expect(out).to include "[DEPRECATED FOR 2.0] The `--force` option has been renamed to `--redownload`"
end
- it "shows a deprecation when multiple flags passed", :bundler => 2 do
+ it "shows a deprecation when multiple flags passed" do
bundle! "update rack --no-color --force"
expect(out).to include "[DEPRECATED FOR 2.0] The `--force` option has been renamed to `--redownload`"
end
-
- it "does not show a deprecation when single flag passed", :bundler => "< 2" do
- bundle! "update rack --force"
- expect(out).not_to include "[DEPRECATED FOR 2.0] The `--force` option has been renamed to `--redownload`"
- end
-
- it "does not show a deprecation when multiple flags passed", :bundler => "< 2" do
- bundle! "update rack --no-color --force"
- expect(out).not_to include "[DEPRECATED FOR 2.0] The `--force` option has been renamed to `--redownload`"
- end
end
describe "with --redownload" do