spec/features/masquerade_feature_spec.rb
# This is all a manual workaround for not being able to click on links that use
# jquery_ujs in RackTest (there's no JS running to interpret the click and translate it
# into a post request).  If we just used `visit` directly, it'd make a get request and
# not work.
#
# This doesn't actually test the content of the link on the page.
This is all a manual workaround for not being able to click on links that use
jquery_ujs in RackTest (there's no JS running to interpret the click and translate it
into a post request).  If we just used `visit` directly, it'd make a get request and
not work.

This doesn't actually test the content of the link on the page.
This is all a manual workaround for not being able to click on links that use jquery_ujs in RackTest ( there ' s no JS running to interpret the click and translate it into a post request ) . If we just used ` visit ` directly it ' d make a get request and not work . This doesn ' t actually test the content of the link on the page .
def simulate_clicking_become_link(page, target_educator_email)
    page.driver.post admin_masquerade_become_url(masquerading_educator_id: pals.shs_jodi.id)
    page.driver.post page.driver.response.location
    visit page.driver.response.location
  end
def simulate_clicking_become_link ( page , target_educator_email ) page . driver . post admin_masquerade_become_url ( masquerading_educator_id : pals . shs_jodi . id ) page . driver . post page . driver . response . location visit page . driver . response . location end
This is all a manual workaround for not being able to click on links that use
jquery_ujs in RackTest (there's no JS running to interpret the click and translate it
into a post request).
This is all a manual workaround for not being able to click on links that use jquery_ujs in RackTest ( there ' s no JS running to interpret the click and translate it into a post request ) .
# I'm not sure why, but everything to this point has been http, and this # redirects to https.  Also not sure why Capybara doesn't follow this (perhaps # because we're manually make posting requests to RackTest.  Either way, # this manually follows the redirect and makes another post to the same path at https. # And one more time we manually follow the expected redirect (in this case it's back to # the home page).
page
<not_specific>
target_educator_email
<not_specific>