diff options
author | Akira Matsuda & yui-knk <ronnie@dio.jp> | 2017-09-01 18:40:19 +0900 |
---|---|---|
committer | Akira Matsuda <ronnie@dio.jp> | 2017-09-01 18:43:22 +0900 |
commit | 8ad8093accc2ab8a8bc727af02127a0b5d1a56f3 (patch) | |
tree | 91b5062e3c6d12591263c57f1a7a2338d20f71a3 | |
parent | 61f92f8bc5fa0b486fc56f249fa23f1102e79759 (diff) | |
download | rails-8ad8093accc2ab8a8bc727af02127a0b5d1a56f3.tar.gz rails-8ad8093accc2ab8a8bc727af02127a0b5d1a56f3.tar.bz2 rails-8ad8093accc2ab8a8bc727af02127a0b5d1a56f3.zip |
Suppress "unused variable" in Ruby 2.5
-rw-r--r-- | activesupport/test/test_case_test.rb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/activesupport/test/test_case_test.rb b/activesupport/test/test_case_test.rb index 8830c9b348..65b1cb4a14 100644 --- a/activesupport/test/test_case_test.rb +++ b/activesupport/test/test_case_test.rb @@ -87,7 +87,8 @@ class AssertDifferenceTest < ActiveSupport::TestCase def test_expression_is_evaluated_in_the_appropriate_scope silence_warnings do - local_scope = local_scope = "foo" + local_scope = "foo"; + local_scope = local_scope # to suppress unused variable warning assert_difference("local_scope; @object.num") { @object.increment } end end @@ -200,7 +201,7 @@ class AssertDifferenceTest < ActiveSupport::TestCase def test_assert_changes_with_to_and_case_operator token = nil - assert_changes "token", to: /\w{32}/ do + assert_changes -> { token }, to: /\w{32}/ do token = SecureRandom.hex end end @@ -208,7 +209,7 @@ class AssertDifferenceTest < ActiveSupport::TestCase def test_assert_changes_with_to_and_from_and_case_operator token = SecureRandom.hex - assert_changes "token", from: /\w{32}/, to: /\w{32}/ do + assert_changes -> { token }, from: /\w{32}/, to: /\w{32}/ do token = SecureRandom.hex end end |