This project was created as a project for the Turing School of Software & Design. The purpose is to build foundational knowledge of API consumption, implementing WebMock and VCR for API testing, utilizing the facade and service design patterns, build self-referential relationship, and deploy continuous integration for the web app. We will also strengthen knowledge of TDD, perform refactoring, and stylize the web pages.
This project was completed by Hash G and Nico R
To see a live version click here -> https://dry-tor-99046.herokuapp.com/
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
This project was built using ruby version 2.5.3 and rails 5.2.4.3. Ensure that you either install these versions or change the versions in the Gemfile.
This project uses postgresql for database management. Please download the Postgres.app and follow the documentation to also install the CLI tools.
In addition to the standard rails gems, we used the following gems:
rspec
, capybara
, simplecov
, pry
, shoulda-matchers
, webmock
, vcr
, faraday
, figaro
, bcrypt
, and rubocop
.
- RSpec - Test Suite
- Capybara - Additional Testing Tools
- SimpleCov - Test Coverage
- Pry - Runtime Dev Console
- Shoulda Matchers - Additional Testing Tools
- WebMock - API Testing Tool
- VCR - Additional API Testing Tool
- Faraday - API Consumption
- Figaro - API Key Protection
- BCrypt - Password Protection for Authentication
- RuboCop - Linter (optional)
Please follow the documentation for each gem for proper installation and functionality. Note: Most needed files/code are already added (rails_helper, spec_helper, etc.)
If you plan on making your own changes and intend to push it back up, fork this repository then clone it into your directory of choice. In the main project directory, delete the file Gemfile.lock. Then, in your terminal, from the project directory run bundle install
to install all the needed gems.
To setup the database from your terminal, run the following commands:
rails db:create
rails db:migrate
rails db:seed
This will create your database, migrate the needed resources then seed the database with starting data.
Visit The Movie Database API to create an account and obtain an API key. Refer to the Figaro gem documentation to create your own application.yml
and place your key as follows:
TMDB_API_KEY: 'INSERT KEY HERE'
From your main directory in the command line, type bundle exec rspec
. This will run all tests located in the /spec directory. If any errors or failures occur please create and issue.
To run specific test files, include the file path.
bundle exec rspec spec/features/shelters/index_spec.rb
Before full cloud based deployment, check that the web app is working locally by opening a new tab in terminal and run the command rails s
. This will run a local server which you can connect to. Type localhost:3000
into your web browsers address bar and hit enter. You should see the root page with a welcome message and a login field.
Cloud deployment was done with Heroku. Visit the "getting started with rails" on how to deploy the web app to Heroku.