0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

RSpec3.8でセッション、クッキーを参照したい時のメモ

Last updated at Posted at 2018-09-11

環境

  • Rails5.2
  • RSpec3.8

やり方

# セッションを参照したいとき
session['user_id']
# クッキーを参照したいとき
@response.cookies['remember_token']
@request.cookies['user_id']

最後に

Rails tutorialの2週目を進めていてRSpecでやってみようと思ったときに、9章あたりでundefined method `signed'とエラーがでた。  
ログアウトのテストとして、セッションとクッキーが削除されていることを確認した時に調べたメモ

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?