Skip to content

Instantly share code, notes, and snippets.

@naw
Last active August 29, 2015 14:11
Show Gist options
  • Save naw/dfd6b6b1f0d8956efee7 to your computer and use it in GitHub Desktop.
Save naw/dfd6b6b1f0d8956efee7 to your computer and use it in GitHub Desktop.
Capybara save_and_open_page after AJAX, before failed expectation
def original
click_link "Load something" # Runs AJAX
expect(page).to have_content('Something')
end
def bad
click_link "Load something" # Runs AJAX
save_and_open_page # to see why it isn't loading
expect(page).to have_content('Something')
end
def good
click_link "Load something" # Runs AJAX
begin
expect(page).to have_content('Something')
rescue Exception
save_and_open_page # to see whether it is loading anything at all
raise
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment