pezra / rspec-mode

An RSpec minor mode for Emacs
257 stars 112 forks source link

When executing via docker, execute in the context of the docker file #213

Closed johnhamelink closed 1 year ago

johnhamelink commented 1 year ago

Hi there,

This PR modifies rspec mode's docker wrapper, ensuring that the docker command execution happens in the same directory as the docker file (or docker-compose file).

This allows me to run rspec using a docker-compose file which is outside of the ruby project root, and by having default-directory set to my ruby project root means that relative filepaths in stacktraces map correctly.

dgutov commented 1 year ago

Hi!

First of all, you did some weird rebasing here: looks like the first commit in the branch is mine (a tiny one) which you amended?

johnhamelink commented 1 year ago

Hey there,

Since writing this, I've now moved to using a custom wrapper for podman-compose, which solves my problem better:

(defun jjh/rspec--compose-default-wrapper (compose compose-service command)
  "Function for wrapping a command for executiuon inside a compose
environment. Podman requires that the compose.yml file is defined
before the exec argument, so we have to hard-code the podman-compose
portion of the command."
  (format "podman-compose -f %s exec %s sh -c \"%s\""
          rspec-docker-file-name compose-service command))