Capybara 2.1 beta1 compatibility

This PR addresses the additional changes mentioned in https://github.com/jnicklas/capybara/issues/984.

a5c51b2 should also fix #303 and #384.