fix contact_link sorting on associations #3888

ransack does not handle ORDER BY on non-selected columns when SELECT
DISTINCT is used, it should select the columns to avoid postgresql
exploding. Here it is added manually based on what ransack parses as
the sort

Upgrading to ransack 0.7.2 caused the select to overwrite the original
selects instead of appending, hence the version lock.
integration tests for contact_links sorting #3888

I took the opportunity to set up RSpec and Capybara for integration
tests. This is an alternative to Cucumber.