Fix insert_before in CredentialResolver

This method was not updated to use the same interface
as insert_after.  Now both methods are working as expected.
Added a unit tests for insert_before, as it look like there
previously was not one.

cc @kyleknap @danielgtaylor