Skip to content

Instantly share code, notes, and snippets.

@YumaInaura
Created May 23, 2024 22:25
Show Gist options
  • Save YumaInaura/7d6557b26def3c7be8dd913aba871e5e to your computer and use it in GitHub Desktop.
Save YumaInaura/7d6557b26def3c7be8dd913aba871e5e to your computer and use it in GitHub Desktop.
Rails - Example of how to run Rspec on Docker from Makefile

overview

  • Requires docker-compose configuration
  • Specify the file name using RSPEC_TARGET as an argument to Make
  • local assumes that the Rails directory is below the directory where the Makefile is located (e.g. some_rails_directory )

Makefile

rspec:
docker-compose run --rm -e RAILS_ENV=test <docker_service_name> rspec ${RSPEC_TARGET:some_rails_directory/%=%}

Execution example

make rspec RSPEC_TARGET=spec/dir/
make rspec RSPEC_TARGET=spec/dir/example_spec.rb
make rspec RSPEC_TARGET=spec/dir/example_spec.rb:11

Recruiting chat members

If you have any questions, concerns, or consultations, please use LINE open chat.

https://line.me/ti/g2/eEPltQ6Tzh3pYAZV8JXKZqc7PJ6L0rpm573dcQ

Profile/Career

https://github.com/YumaInaura/YumaInaura

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment