Don't just mount spec
folder, but complete app
folder for tests
#648
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is to ensure that local changes in the
app
folder are reflected in the Docker container such that newly written tests can be run through without having to rebuild the whole Docker image.While the whole
app
folder is mounted to/usr/src/app/app
, wee construct a specificpublic
volume such that therake assets:precompile
task can populate the folderusr/src/app/public/packs-test/
.Note that all files are still copied in the
Dockerfile
such thatrails assets:precompile
can work correctly. Theapp/
folder is then later mounted "on top" of that.Also moved the entrypoint declaration to the place where it's declared in the development setup, just to achieve symmetry.
For reviewers
Please delete your old mampf test image (if you have one locally) before testing the changes made in this PR.
A good way to test the changes in this PR could be as follows:
git fetch
git switch feature/user-cleaner
git merge tests/mount-app-folder
(only for your local playground, so please don't push)app/models/user_cleaner.rb
touser_cleaner_changed.rb
(also the class name). Adjust accordingly inuser_cleaner_spec.rb
. Then, run the tests again. Everything should still work fine. With this procedure, you've checked that the locally changed file content (user_cleaner_changed.rb
) is available in the Docker container. If it wasn't, you would get an error saying that there was no class calledUserCleanerChanged
.git reset --hard origin/feature/user-cleaner
. Note this will hard-reset any modified changes! Instead, you could also dogit reset HEAD~1
to keep your modifications (and those by the initial git merge you made).