Web サイトの統合テストの一環として、キュウリとカピバラを使用しています。カピバラはクッキーの使用をエミュレートできないようです。
たとえば、ユーザーがサインインするときに Cookie を設定します。
def sign_in(user)
cookies.permanent.signed[:remember_token] = [user.id, user.salt]
current_user = user
end
ただし、後で cookies.inspect を使用して Cookie の値をフェッチすると、{} が返されます。これはカピバラの既知の制限ですか? この場合、複数のリクエストでサインインしているユーザーをテストするにはどうすればよいですか?
テストを追加する必要があります:
Scenario: User is signed in when they press Sign In
Given I have an existing account with email "bob@jones.com" and password "123456"
And I am on the signin page
When I fill in "Email" with "bob@jones.com"
And I fill in "Password" with "123456"
And I press "Sign In"
Then I should see "Welcome Bob Jones"