DEV: Fix state leak in test causing flaky tests (#26282)

Why this change?

The test registers a category custom field to preload but doesn't remove
it at the end of the test causing a state leak which can result in other
tests failing.
This commit is contained in:
Alan Guo Xiang Tan 2024-03-21 10:49:13 +08:00 committed by GitHub
parent ef2a9da8e7
commit 4c667f16c7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1166,6 +1166,8 @@ RSpec.describe CategoriesController do
expect(response.parsed_body["categories"].length).to eq(1)
expect(response.parsed_body["categories"][0]["custom_fields"]).to eq("bob" => "marley")
ensure
Site.reset_preloaded_category_custom_fields
end
context "without include_ancestors" do