Do not write special code for testing within the controller or model at any time in the tutorial,
as others might likely copy and paste it in their production code.
Instead, override behavior in the tests (e.g. with Mock::Quick ) or better, use a LDAP server you can spawn directly within the tests: Net::LDAP::Server::Test
With 'auto_schema' set in the LDAP test server, you can simply add users to your liking and use the same code for testing as for production.
from Oliver Günther:
Do not write special code for testing within the controller or model at any time in the tutorial, as others might likely copy and paste it in their production code.
Instead, override behavior in the tests (e.g. with Mock::Quick ) or better, use a LDAP server you can spawn directly within the tests: Net::LDAP::Server::Test
With 'auto_schema' set in the LDAP test server, you can simply add users to your liking and use the same code for testing as for production.