Make sure that the test case is run under test env

* Unset $RAILS_ENV that got set by abstract_unit to trigger the default.
* split out environment setting since Ruby 1.9.3 doesn't support inline
  ENV setting.