Last active
July 13, 2020 02:22
-
-
Save terenceponce/cd35094cec62a21be742 to your computer and use it in GitHub Desktop.
Creating Signed Cookies in Capybara
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# spec/features/profile_management_spec.rb | |
require 'rails_helper' | |
feature 'Profile Management', type: :feature do | |
given!(:user) { create(:user) } | |
scenario 'User updates profile' do | |
cookie = SignedCookieGenerator.new(:auth, user.id) | |
page.driver.browser.set_cookie(cookie.to_s) | |
visit '/account/profile' | |
expect(page).to have_text('Profile Page') | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Blog post where this code snippet is posted: http://terenceponce.com/post/129755084060/creating-signed-cookies-in-capybara