Test Rails 4.0 and 4.1 branches and master with different Gemfiles

Point Gemfile to master branch.
Conditional check for AR 4.0 rather than 4.1

4.0 version won't change over time, and we want to test differences
against >= 4.1, which means current master too.

This fixes failures with AR options like :counter_sql that were removed
from 4.1/master. Tests are still red.