diff options
| -rw-r--r-- | lib/bundler/current_ruby.rb | 16 | ||||
| -rw-r--r-- | spec/bundler/bundler/current_ruby_spec.rb | 14 |
2 files changed, 6 insertions, 24 deletions
diff --git a/lib/bundler/current_ruby.rb b/lib/bundler/current_ruby.rb index faec695369..b350baa24f 100644 --- a/lib/bundler/current_ruby.rb +++ b/lib/bundler/current_ruby.rb @@ -50,19 +50,10 @@ module Bundler end def maglev? - message = - "`CurrentRuby#maglev?` is deprecated with no replacement. Please use the " \ - "built-in Ruby `RUBY_ENGINE` constant to check the Ruby implementation you are running on." removed_message = "`CurrentRuby#maglev?` was removed with no replacement. Please use the " \ "built-in Ruby `RUBY_ENGINE` constant to check the Ruby implementation you are running on." - internally_exempted = caller_locations(1, 1).first.path == __FILE__ - - unless internally_exempted - SharedHelpers.major_deprecation(2, message, removed_message: removed_message, print_caller_location: true) - end - - RUBY_ENGINE == "maglev" + SharedHelpers.feature_removed!(removed_message) end def truffleruby? @@ -90,14 +81,11 @@ module Bundler end define_method(:"maglev_#{trimmed_version}?") do - message = - "`CurrentRuby##{__method__}` is deprecated with no replacement. Please use the " \ - "built-in Ruby `RUBY_ENGINE` and `RUBY_VERSION` constants to perform a similar check." removed_message = "`CurrentRuby##{__method__}` was removed with no replacement. Please use the " \ "built-in Ruby `RUBY_ENGINE` and `RUBY_VERSION` constants to perform a similar check." - SharedHelpers.major_deprecation(2, message, removed_message: removed_message, print_caller_location: true) + SharedHelpers.feature_removed!(removed_message) send(:"maglev?") && send(:"on_#{trimmed_version}?") end diff --git a/spec/bundler/bundler/current_ruby_spec.rb b/spec/bundler/bundler/current_ruby_spec.rb index 8764c4971f..83c42e73e1 100644 --- a/spec/bundler/bundler/current_ruby_spec.rb +++ b/spec/bundler/bundler/current_ruby_spec.rb @@ -139,18 +139,12 @@ RSpec.describe Bundler::CurrentRuby do end describe "Deprecated platform" do - it "Outputs a deprecation warning when calling maglev?" do - expect(Bundler.ui).to receive(:warn).with(/`CurrentRuby#maglev\?` is deprecated with no replacement./) - - Bundler.current_ruby.maglev? + it "outputs an error and aborts when calling maglev?" do + expect { Bundler.current_ruby.maglev? }.to raise_error(Bundler::RemovedError, /`CurrentRuby#maglev\?` was removed with no replacement./) end - it "Outputs a deprecation warning when calling maglev_31?" do - expect(Bundler.ui).to receive(:warn).with(/`CurrentRuby#maglev_31\?` is deprecated with no replacement./) - - Bundler.current_ruby.maglev_31? + it "outputs an error and aborts when calling maglev_31?" do + expect { Bundler.current_ruby.maglev_31? }.to raise_error(Bundler::RemovedError, /`CurrentRuby#maglev_31\?` was removed with no replacement./) end - - pending "is removed and shows a helpful error message about it", bundler: "4" end end |
