fix uninitialized constant RSpec when running rake RAILS_ENV=test db:setup
use appropriate exception class depending on ruby version