Day 8

Don’t wait until you’re traveling to download the documenation

Still fighting with tests for my phone first sign-in process today. After trying a few different things, I’ve written a test helper function to simulate visiting the site as a certain person.

def visit_as(user)
device = user.devices.first
# this line isn't working yet
get root_url, headers: { cookies: “device_token:#{device.token}” }
assert_response :success
assert_equal device.token, cookies[:device_token]

This pulls a device for a specific user and visits the main page of the site. The part that’s not working is setting the cookie. Unfortunately, I’m working on an airplane and the wifi isn’t working, so I can’t look up the syntax for sending the headers, but I think I’m on the right track.

Seems obvious, but when traveling, you can’t always count on your Internet connection, so it’s helpful to have some form of documentation locally. I’ve been meaning to try Dash for local documentation and now I’m wishing I already had it. Might be worth getting it today so you have it when you need it.