From eac6f3c8f710194ee518f8c94a91fc5f6383d440 Mon Sep 17 00:00:00 2001 From: vinistock <18742907+vinistock@users.noreply.github.com> Date: Wed, 29 Jan 2025 15:58:05 +0000 Subject: [PATCH] Search for expected add-on in test (#3106) ### Motivation This test is flaky because sometimes `Addon.addons.first` returns the RuboCop add-on instead of the one defined in the test. Let's avoid having this test be order dependent. --- test/addon_test.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/addon_test.rb b/test/addon_test.rb index 96e4bc445..5734c1fbb 100644 --- a/test/addon_test.rb +++ b/test/addon_test.rb @@ -54,7 +54,9 @@ def test_registering_an_addon_invokes_activate_on_initialized def test_addons_are_automatically_tracked Addon.load_addons(@global_state, @outgoing_queue) - assert_equal(123, T.unsafe(Addon.addons.first).field) + + addon = Addon.addons.find { |addon| addon.is_a?(@addon) } + assert_equal(123, T.unsafe(addon).field) end def test_loading_addons_initializes_them