DEV: Fix flaky test

This commit is contained in:
Dan Ungureanu 2020-07-07 17:10:24 +03:00
parent 333d4f9a98
commit 57d46694c5
No known key found for this signature in database
GPG Key ID: 0AA2A00D6ACC8B84
1 changed files with 7 additions and 3 deletions

View File

@ -66,6 +66,10 @@ describe CategoryHashtagsController do
quxbar = Fabricate(:category_with_definition, slug: "bar", parent_category_id: qux.id)
quxbarbaz = Fabricate(:category_with_definition, slug: "baz", parent_category_id: quxbar.id)
first_bar = foobar.id < quxbar.id ? foobar : quxbar
first_baz = foobarbaz.id < quxbarbaz.id ? foobarbaz : quxbarbaz
first_barbaz = foobar.id < quxbar.id ? foobarbaz : quxbarbaz
get "/category_hashtags/check.json", params: {
category_slugs: [
":",
@ -84,10 +88,10 @@ describe CategoryHashtagsController do
expect(response.status).to eq(200)
expect(response.parsed_body["valid"]).to contain_exactly(
{ "slug" => "foo", "url" => foo.url },
{ "slug" => "bar", "url" => foobar.url },
{ "slug" => "bar", "url" => first_bar.url },
{ "slug" => "foo:bar", "url" => foobar.url },
{ "slug" => "baz", "url" => foobarbaz.url },
{ "slug" => "bar:baz", "url" => foobarbaz.url },
{ "slug" => "baz", "url" => first_baz.url },
{ "slug" => "bar:baz", "url" => first_barbaz.url },
{ "slug" => "qux", "url" => qux.url },
{ "slug" => "qux:bar", "url" => quxbar.url }
)