Cover undo controller with specs. Introduce undo_context factory.