Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions db/fixtures/hibernations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,45 @@ hibernation2:
reason: 学習時間が取れないため
returned_at: 202l-09-01 00:00:00
created_at: 2022-01-10 00:00:02

hibernation3:
user: unhibernated
scheduled_return_on: <%= Time.current + 30.days %>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

なるべくnowやcurrentは使わず固定の時間にして、テストの方でtravel_toを使うやり方のほうがよいかなとおもいます。

なぜなら、現在時刻に依存したテストは再現性が低く、こまったテストになることがおおいからです。

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@komagata
db/fixtures/以下にあるデータは自動テストでは使用されるものではないため、nowやcurrentを使用しても問題ないという認識です。これらは開発環境やステージング環境における、画面上での動作確認において使用されるシードデータだと認識しています。
こちらでも固定の時間にするべきでしょうか?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@s-tone-gs

すみません、test/fixturesと見間違えていました。修正しなくて大丈夫です。

reason: メンタル不調のため
created_at: <%= Time.current - 13.days %>

hibernation4:
user: autoretire-within-1-hour
scheduled_return_on: <%= Time.current + 30.days %>
reason: 家庭の事情
created_at: <%= Time.current - 3.months + 30.minutes %>

hibernation5:
user: autoretire-within-24-hour
scheduled_return_on: <%= Time.current + 30.days %>
reason: 時間が無くなったため
created_at: <%= Time.current - 3.months + 23.hours %>

hibernation6:
user: autoretire-within-1-week
scheduled_return_on: <%= Time.current + 30.days %>
reason: お金が足りなくなったため
created_at: <%= Time.current - 3.months + 1.week %>

hibernation7:
user: autoretire-over-1-week
scheduled_return_on: <%= Time.current + 30.days %>
reason: 事故でしばらく動けないため
created_at: <%= Time.current - 3.months + 1.week + 1.day %>

hibernation8:
user: not-autoretire
scheduled_return_on: <%= Time.current + 30.days %>
reason: 指を骨折してプログラミングができないため
created_at: <%= Time.current - 6.months%>

hibernation9:
user: nagai-kyuukai
scheduled_return_on: <%= Time.current + 30.days %>
reason: オンラインでのコミュニケーションが向いていないと感じたため
created_at: <%= Time.current - 3.months %>