Added config_by_name tests and made it raise a better exception.
Added some explanation for this sad test.
Cleaned up some duplication.