/my_factory_bot

fork de my_factory_bot

Primary LanguageRuby

Usage Instructions

Prerequisites

In order to run this project you'll need to have Docker installed.

Instructions

Clone the repo

git clone https://github.com/jasonswett/my_factory_bot.git
cd my_factory_bot

Start the web service

docker compose run web

Shell into the container

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.

Run my_factory_bot.rb

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.