Skip to content

Commit

Permalink
Fix code to support older versions of Ruby
Browse files Browse the repository at this point in the history
We still support super old versions, yes, and it doesn't like `ensure`
without a `begin..end` unfortunately.

I plan to remove this support soon, but for now I don't want to stop
supporting it yet.
  • Loading branch information
carlosantoniodasilva committed Oct 10, 2023
1 parent 9784555 commit fb7faf7
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,14 @@ class ActiveSupport::TestCase
if ActiveSupport.version < Gem::Version.new("5.0")
def assert_deprecated(match, deprecator)
super(match) do
behavior = deprecator.behavior
deprecator.behavior = ActiveSupport::Deprecation.behavior
yield
ensure
deprecator.behavior = behavior
# TODO: remove extra begin..end when dropping support for Ruby <= 2.4
begin
behavior = deprecator.behavior
deprecator.behavior = ActiveSupport::Deprecation.behavior
yield
ensure
deprecator.behavior = behavior
end
end
end
end
Expand Down

0 comments on commit fb7faf7

Please sign in to comment.