【読者限定】テックキャンプの割引情報はこちら

10月29日の学習内容「ログイン機能の」

こんにちは、あおい(@aoi_programmer)です。
本日もお疲れ様です。

本日の勉強内容

https://twitter.com/aoi_programming/status/1321628607295365121?s=20

上記の通りになります。
では、学んだ内容を順にアウトプットしていきます。

思考の整理

create_list(:user, 10)

https://twitter.com/aoi_programming/status/1321735316651171840?s=20

テストコードにて複数のインスタンスを作成してくれるので、ページネーションなど、複数のインスタンスが必要とするテストコードでは必須のメソッドですね

trait

https://twitter.com/aoi_programming/status/1321750430519455744?s=20

こちらもテストコードで使う記法。

ツイートでは
let!(:admin_user) { create(:user, :admin) }

と記述していますが、現在は記法を変更しています。

@admin_user = FactoryBot.create(:user, :admin)

的な感じで記述してます😌

53 COMMENTS

houston junk car buyer

Have you ever thought about creating an ebook or guest authoring on other blogs?

I have a blog centered on the same subjects you discuss and would really like to have you
share some stories/information. I know my subscribers would enjoy your work.

If you’re even remotely interested, feel free to send
me an e mail.

返信する

コメントを残す

メールアドレスが公開されることはありません。