Skip to content

Commit ec9700a

Browse files
committed
Fix "Test is missing assertions" in middleware_stack_proxy_test.rb
`Minitest::Mock#expect` does not increase a test's assertions count. What I did in this PR is simply increment `self.assertions` when the custom `#assert_playback` method is called.
1 parent 8ceb7b9 commit ec9700a

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

railties/test/configuration/middleware_stack_proxy_test.rb

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,18 +63,16 @@ def test_order
6363
@stack.swap :foo
6464
@stack.delete :foo
6565

66-
mock = Minitest::Mock.new
67-
mock.expect :swap, nil, [:foo]
68-
mock.expect :delete, nil, [:foo]
69-
70-
@stack.merge_into mock
71-
mock.verify
66+
assert_playback([:swap, :delete], :foo)
7267
end
7368

7469
private
75-
def assert_playback(msg_name, args)
70+
def assert_playback(msg_names, args)
71+
self.assertions += 1
7672
mock = Minitest::Mock.new
77-
mock.expect msg_name, nil, [args]
73+
Array(msg_names).each do |msg_name|
74+
mock.expect msg_name, nil, [args]
75+
end
7876
@stack.merge_into(mock)
7977
mock.verify
8078
end

0 commit comments

Comments
 (0)