Refactor capybara test to be more DRY