From 03dd47ff219098305a588e16d717813eebbfa7a4 Mon Sep 17 00:00:00 2001 From: Shuhei Kitagawa Date: Sat, 28 Oct 2017 17:39:58 +0900 Subject: removed unnecessary semicolons --- activesupport/test/test_case_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activesupport/test/test_case_test.rb') diff --git a/activesupport/test/test_case_test.rb b/activesupport/test/test_case_test.rb index 65b1cb4a14..9bc9183668 100644 --- a/activesupport/test/test_case_test.rb +++ b/activesupport/test/test_case_test.rb @@ -87,7 +87,7 @@ class AssertDifferenceTest < ActiveSupport::TestCase def test_expression_is_evaluated_in_the_appropriate_scope silence_warnings do - local_scope = "foo"; + local_scope = "foo" local_scope = local_scope # to suppress unused variable warning assert_difference("local_scope; @object.num") { @object.increment } end -- cgit v1.2.3 From bbe437faecca5fd6bdc2327a4bc7a31ba21afe2e Mon Sep 17 00:00:00 2001 From: Genadi Samokovarov Date: Tue, 7 Nov 2017 10:28:19 +0200 Subject: Use plain assert in assert_changes to avoid MT6 refutes Seeing the previously issued PRs about it, we can avoid the `nil` comparisons that can happen in `assert_changes` by using plain `assert` calls. This is to avoid a deprecation warning about comparing `nil` values in `assert_equal` for Minitest 5 and a crash in Minitest 6. You can see the preparations done in [`assert_equal`][ae]. You can also see that [`assert`][a] does not care about `nil`s. [ae]: https://github.com/seattlerb/minitest/blob/ca6a71ca901016db09a5ad466b4adea4b52a504a/lib/minitest/assertions.rb#L159-L188 [a]: https://github.com/seattlerb/minitest/blob/ca6a71ca901016db09a5ad466b4adea4b52a504a/lib/minitest/assertions.rb#L131-L142 --- activesupport/test/test_case_test.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'activesupport/test/test_case_test.rb') diff --git a/activesupport/test/test_case_test.rb b/activesupport/test/test_case_test.rb index 9bc9183668..84e4953fe2 100644 --- a/activesupport/test/test_case_test.rb +++ b/activesupport/test/test_case_test.rb @@ -179,6 +179,7 @@ class AssertDifferenceTest < ActiveSupport::TestCase end def test_assert_changes_works_with_any_object + # Silences: instance variable @new_object not initialized. retval = silence_warnings do assert_changes :@new_object, from: nil, to: 42 do @new_object = 42 @@ -201,7 +202,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 @@ -236,7 +237,7 @@ class AssertDifferenceTest < ActiveSupport::TestCase end end - assert_equal "@object.num should not change.\n\"@object.num\" did change to 1.\nExpected: 0\n Actual: 1", error.message + assert_equal "@object.num should not change.\n\"@object.num\" did change to 1", error.message end end -- cgit v1.2.3