Only require generator_spec when needed

generator_spec has a dependency on Railties, which defines the Rails
module, apparently without defining the .env method that is needed
when testing on Rails 4.1.

See https://github.com/rails/rails/blob/v4.1.0/activerecord/lib/active_record/connection_handling.rb#L3
Merge pull request #1369 from bquorning/bquorning/fix-4.1-specs

Only require generator_spec when needed