diff options
author | David RodrÃguez <deivid.rodriguez@riseup.net> | 2019-03-14 13:29:11 +0100 |
---|---|---|
committer | David RodrÃguez <deivid.rodriguez@riseup.net> | 2019-03-14 14:49:07 +0100 |
commit | a87cdf6ffdc31a51db6f1598de294c5a261d7d79 (patch) | |
tree | db2e8458eea73684b4a976f7e51470a2bd4845f2 | |
parent | 59652415cfe26353633eb415514f3fd39d443237 (diff) | |
download | bundler-a87cdf6ffdc31a51db6f1598de294c5a261d7d79.tar.gz |
Fix broken deprecation specs
These specs were only passing on bundler 2 because the matcher is buggy.
Now they are correct.
-rw-r--r-- | spec/other/major_deprecation_spec.rb | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/spec/other/major_deprecation_spec.rb b/spec/other/major_deprecation_spec.rb index fabf6321d1..3841ebb626 100644 --- a/spec/other/major_deprecation_spec.rb +++ b/spec/other/major_deprecation_spec.rb @@ -14,9 +14,16 @@ RSpec.describe "major deprecations" do end describe ".clean_env" do - it "is deprecated in favor of .unbundled_env" do + before do source = "Bundler.clean_env" bundle "exec ruby -e #{source.dump}" + end + + it "is not deprecated", :bundler => "< 2" do + expect(warnings).not_to have_major_deprecation + end + + it "is deprecated in favor of .unbundled_env", :bundler => "2" do expect(warnings).to have_major_deprecation \ "`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`" @@ -24,9 +31,16 @@ RSpec.describe "major deprecations" do end describe ".environment" do - it "is deprecated in favor of .load" do + before do source = "Bundler.environment" bundle "exec ruby -e #{source.dump}" + end + + it "is not deprecated", :bundler => "< 2" do + expect(warnings).not_to have_major_deprecation + end + + it "is deprecated in favor of .load", :bundler => "2" do expect(warnings).to have_major_deprecation "Bundler.environment has been removed in favor of Bundler.load" end end @@ -191,11 +205,17 @@ RSpec.describe "major deprecations" do end context "when `bundler/deployment` is required in a ruby script" do - it "should print a capistrano deprecation warning" do + before do ruby(<<-RUBY) require 'bundler/deployment' RUBY + end + + it "should not print a capistrano deprecation warning", :bundler => "< 2" do + expect(warnings).not_to have_major_deprecation + end + it "should print a capistrano deprecation warning", :bundler => "2" do expect(warnings).to have_major_deprecation("Bundler no longer integrates " \ "with Capistrano, but Capistrano provides " \ "its own integration with Bundler via the " \ |