Fix rails version selection

Previous code wasn't working correctly
Fix tests for rails 4.1