Refactor the Rails initialization tests to use the same ENV variable
Restore the original state of ENV before every test

This fixes intermittent test failures due to carried-over ENV variables
from previous tests.