Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
目的
次の Flaky なテストを常に成功させるため、検索結果の並び順が一意に定まるようにする
bootcamp/test/models/searcher_test.rb
Lines 64 to 68 in b066003
調査したこと
このテストで確認していること
検索結果が次のコードで指定されている
.sort_by(&:updated_at).reverse
の順番になっていることbootcamp/app/models/searcher.rb
Lines 56 to 58 in b066003
テストが Flaky な原因
検索結果の
reports(:report12), reports(:report14), reports(:report13)
のフィクスチャにupdated_at
が設定されていないため、すべてupdated_at
が同値となり、sort_by(&:updated_at)
の結果が一意に定まらないためやったこと
検索結果の
reports(:report12), reports(:report14), reports(:report13)
それぞれのフィクスチャにupdated_at
の値を設定したなお、
updated_at
の値はそれぞれのcreated_at
の値と同じにした