mirror of
https://github.com/discourse/discourse.git
synced 2025-06-17 22:12:38 +08:00
DEV: Fix flaky test (#25935)
Returned results are ordered by ID, but the fabricated category and private_category IDs are not always generated in the same order. This caused the expected and actual results to be in different orders.
This commit is contained in:
@ -88,9 +88,7 @@ RSpec.describe HashtagsController do
|
|||||||
get "/hashtags/by-ids.json", params: { category: [category.id, private_category.id, -1] }
|
get "/hashtags/by-ids.json", params: { category: [category.id, private_category.id, -1] }
|
||||||
|
|
||||||
expect(response.status).to eq(200)
|
expect(response.status).to eq(200)
|
||||||
expect(response.parsed_body).to eq(
|
expect(response.parsed_body["category"]).to contain_exactly(
|
||||||
{
|
|
||||||
"category" => [
|
|
||||||
{
|
{
|
||||||
"relative_url" => category.url,
|
"relative_url" => category.url,
|
||||||
"text" => category.name,
|
"text" => category.name,
|
||||||
@ -113,8 +111,6 @@ RSpec.describe HashtagsController do
|
|||||||
"slug" => private_category.slug,
|
"slug" => private_category.slug,
|
||||||
"id" => private_category.id,
|
"id" => private_category.id,
|
||||||
},
|
},
|
||||||
],
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user