mirror of
https://github.com/heartcombo/devise.git
synced 2026-01-08 22:37:57 -05:00
Fix code to support older versions of Ruby
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.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user