In order to run this project you'll need to have Docker installed.
git clone https://github.com/jasonswett/my_factory_bot.git
cd my_factory_bot
docker compose run web
Run the following command, where abc123
is the ID of the web
container.
Instructions for getting the ID are below.
docker exec -it abc123 /bin/bash
If you run docker container ls
, you should see output similar to the following.
$ docker container ls
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
bf92c5a5435c my_factory_bot "bash -c 'rm -rf /us…" 51 minutes ago Up 51 minutes my_factory_bot_web_run_b0a93042943b
The bf92c5a5435c
is the part you want to copy.
There's a file called my_factory_bot.rb
. This is where you'll put your custom MyFactoryBot
definition.
You can run this file in a Rails context using rails runner
, like this:
rails runner my_factory_bot.rb
If you see the following output, you're good to go:
This is the file where your MyFactoryBot definition will go.