From 51b2b605e78a160790c6d751b2907b836b39561c Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Sun, 30 Jun 2019 22:49:10 +0900 Subject: [PATCH] Call deprecated method only inside assert_warning block --- test/test_cmath.rb | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/test/test_cmath.rb b/test/test_cmath.rb index b3692bc7cf..c603cd2bbe 100644 --- a/test/test_cmath.rb +++ b/test/test_cmath.rb @@ -4,13 +4,11 @@ require 'cmath' class TestCMath < Test::Unit::TestCase def test_deprecated_method - orig = $VERBOSE - $VERBOSE = true + root = nil assert_warning(/CMath#sqrt! is deprecated; use CMath#sqrt or Math#sqrt/) do - CMath.sqrt!(1) + root = CMath.sqrt!(1) end - assert_equal CMath.sqrt(1), CMath.sqrt!(1) - $VERBOSE = orig + assert_equal CMath.sqrt(1), root end def test_sqrt