Skip to content

ammarshah/todoer

Repository files navigation

Todoer

This app was built while learning TDD from Test-Driven Rails tutorial on Upcase.

But I soon felt an urge for using the BDD's outside-in approach and I decided to include Cucumber in the picture along with Capybara and RSpec.

Also, it uses the latest version of Ruby (v3) and Rails (v7) at the time.

Demo

This app is deployed on a free Render tier which spins down the server if it's idle for 15 minutes, so it takes some time to spin up the server again when it next receives a request.

Demo URL: https://todoer-coen.onrender.com/

Project Setup

To setup this project, you'll want to clone and run the setup script for the repo.

$ git clone git@github.com:ammarshah/todoer.git
$ cd todoer
$ cp .env.template .env
$ bin/setup

Run Tests

Run RSpec tests:

# By default, it runs tests in a random order
$ rspec

# Use --seed option if you want to run tests with seed
$ rspec --seed=YOUR_SEED

# For debugging specs order dependency
# use --bisect option to get the minimum
# number of tests to run to reproduce the failure
$ rspec --bisect --seed=YOUR_SEED

Run Cucumber tests:

# By default, it runs tests in a random order
$ cucumber

# Use --order option if you want to run tests with seed
$ cucumber --order=random:YOUR_SEED

Run all tests:

$ rake

Deployment

a. Build the image:

$ docker compose build

b. Tag the image with new build version:

$ docker tag ammarshah/todoer-server:latest ammarshah/todoer-server:1.0.0

c. Push the tag to your Docker Hub repository:

$ docker push ammarshah/todoer-server:1.0.0
$ docker push ammarshah/todoer-server:latest

d. Commit and push the latest code to your GitHub repository:

$ git push origin master

e. Login to your production server via ssh and pull the latest code from GitHub repository:

$ git pull origin master

f. Finally, use docker compose command to run the required services:

$ docker compose up -d

Note: This will pull the latest (pre-built) image for each service, listed in compose.yml, from the Docker Hub registry and run the containers.

The application is accessible at http://your-server-ip.