diff --git a/activesupport/lib/active_support/testing/assertions.rb b/activesupport/lib/active_support/testing/assertions.rb index dbf435292b..63344d00cb 100644 --- a/activesupport/lib/active_support/testing/assertions.rb +++ b/activesupport/lib/active_support/testing/assertions.rb @@ -189,7 +189,7 @@ module ActiveSupport error = "#{expression.inspect} didn't change" error = "#{error}. It was already #{to}" if before == to error = "#{message}.\n#{error}" if message - assert_not_equal before, after, error + refute_equal before, after, error unless to == UNTRACKED error = "Expected change to #{to}\n" diff --git a/activesupport/test/testing/method_call_assertions_test.rb b/activesupport/test/testing/method_call_assertions_test.rb index ba1d55021a..e75630d2e4 100644 --- a/activesupport/test/testing/method_call_assertions_test.rb +++ b/activesupport/test/testing/method_call_assertions_test.rb @@ -200,4 +200,20 @@ class MethodCallAssertionsTest < ActiveSupport::TestCase assert_equal instance, Level.new end end + + def test_assert_changes_when_assertions_are_included + test_unit_class = Class.new(Minitest::Test) do + include ActiveSupport::Testing::Assertions + + def test_assert_changes + counter = 1 + assert_changes(-> { counter }) do + counter = 2 + end + end + end + + test_results = test_unit_class.new(:test_assert_changes).run + assert test_results.passed? + end end