I have written this simple function and I want to stub out the last functions so I don't actually launch a process.
(defun dc-test-stub-process (command &rest params) (interactive) (let ((commands (append (list dc-buffer-name dc-docker-cmd command) params))) (apply #'dc-process commands)))
I have been playing around with this expecting it to fail because it returns
"test" how ever it just passes and it looks like
dc-process is actually called and not stubbed out.
(ert-deftest pp-test-process-function () (setq dc-current-buffer "/") (cl-letf (((symbol-function 'dc-process) (lambda (&rest _) "test")) (should (equal (dc-test-stub-process "a" "d" "c") "test2")))))
I have also tried doing the same but stubbing out
apply with the same results.
Anyone able to spot what's wrong? There is not much info on using
cl-letf but most likely I am doing something wrong as I am still learning lisp.