前提・実現したいこと
Request SpecでJWT認証付きのAPIにリクエストを送るテストを作っています。JWTはCookieに保存しているためRSpecでCookieをセットする必要があるのですが、セットの仕方がわからないので教えていただきたいです。
試したこと
ruby
1RSpec.describe 'Api::User', type: :request do 2 desc 3 context '正しいアクセストークン' do 4 it 'okステータス' 5 cookies[:access_token] = { 6 value: Jwt::Encoder.encode(access_token), 7 expires: 24.hours.from_now, 8 secure: false, 9 http_only: true, 10 } 11 get 'api/user/1' 12 expect(response).to have_http_status(:ok) 13 end 14 end 15 end 16end
よろしくお願いします🙇🏻♂️
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。