dennmart / airport_gap

A fully-functional API to help you improve your test automation skills.

Home Page:https://airportgap.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Airport Gap

Airport Gap is a RESTful API to help you improve your API automation testing skills. It provides access to a database of airports, calculate distances between airports, and allows you to save your favorite airports.

You can create a free Airport Gap account at https://airportgap.com/.

Airport data is provided by OpenFlights.org under the Open Database License.

Airport Gap is provided by Dev Tester - articles and tips to help you improve your test automation skills as a developer.

QuickStart: Setting up and running the application locally

Airport Gap is a Rails 7 application. You need the following dependencies installed to run the application:

  • Ruby (current version: 3.3.0)
  • Bundler (current stable 2.x version)
  • Yarn (current stable version)
  • PostgreSQL (version 12.0 or greater)
  • Foreman (current version)

Once the dependencies are installed, run ./bin/setup to set up the application. The script will perform the following steps automatically:

  • Install Ruby dependencies (bundle install)
  • Install Javascript dependencies (yarn install)
  • Set up the database with seed data (rails db:prepare)

When everything is installed, run ./bin/dev to start all the required processes to build the CSS and JavaScript and start the application server. The application will be accessible at http://localhost:5000/.

Automated tests

The Airport Gap application has a suite of automated tests to help during development.

Unit tests are set up with RSpec. To run the tests, set up the application's Ruby dependencies (bundle install) and a test database, and run rails spec.

End-to-end tests for the API are covered with APId. To run the tests, download the APId binary, set it up in your PATH, and run apid check. The tests require the following environment variables:

  • AIRPORT_GAP_API_URL: The URL of the API endpoints. If you're running the application locally, the URL is http://localhost:5000/api.
  • AIRPORT_GAP_EMAIL: The email address for a valid Airport Gap account in the application.
  • AIRPORT_GAP_PASSWORD: The password for the Airport Gap account in the application.

Docker

A Dockerfile is provided to run the application in a Docker container. You can build the container locally with docker build -t airport-gap ..

To run Airport Gap using a built Docker image, you can use Docker Compose to spin up the application and its required services. The example docker-compose.yml file below starts a PostgreSQL database, a Redis server, and the Airport Gap application.

version: "3.9"
services:
  web:
    image: airportgap:latest
    ports:
      - 3000:3000
    links:
      - postgres
      - redis
    environment:
      - RAILS_ENV=production
      - RACK_ENV=production
      - PGHOST=postgres
      - PGUSER=airport_gap_user
      - PGPASSWORD=airport_gap
      - DATABASE_URL=postgres://airport_gap_user:airport_gap@postgres:5432/airport_gap_db
      - REDIS_URL=redis://redis:6379/0
      - RAILS_SERVE_STATIC_FILES=true
      - RAILS_LOG_TO_STDOUT=true
      - SECRET_KEY_BASE=dsjkfhsdjfhsdjk
    depends_on:
      - postgres
      - redis
  postgres:
    image: postgres:15.2
    expose:
      - 5432
    environment:
      - POSTGRES_DB=airport_gap_db
      - POSTGRES_USER=airport_gap_user
      - POSTGRES_PASSWORD=airport_gap
  redis:
    image: redis:7.0.11
    expose:
      - 6379

To seed the database with data, run docker-compose exec web bundle exec rails db:setup. You can then access the application at http://localhost:3000/.

About

A fully-functional API to help you improve your test automation skills.

https://airportgap.com/

License:MIT License


Languages

Language:HTML 61.6%Language:Ruby 32.9%Language:JavaScript 2.9%Language:CSS 1.3%Language:Dockerfile 1.1%Language:Shell 0.2%Language:Procfile 0.1%