This project was a brownfield project where we were given a codebase that included a lot of dead and useless code intermixed into still useful classes and methods. Our job, given a spec harness was to add functionality and begin refactoring the parts of the code necessary to make the spec harness pass within the time allocated by the project deadline.
For Information on the SPEC HARNESS, please visit:
Turing School BattleShift Spec Harness
For Information on the Technical Specifications for the Project:
Turing School BattleShift Project
To Install and run this application please be aware of the following versions and requirements:
- PostgreSQL 10+
- Rails 5+
- Ruby 2.4+
- ActiveRecord
- ActiveModelSerializers
- PG
- Puma
- First clone down this repository and change directory into the project directory:
git clone https://github.com/nergdnvlt/battleshift.git
cd battleshift
- Then in your command line run bundle to install the gem dependencies:
bundle
- Now setup your database and run the migrations to properly set up your database tables:
rake db:create
rake db:migrate
- It's now time to seed the database with the supplied Etsy-like data:
rake build:users
-
At this point the project is set up. From here you have several options.
-
This will give you access to two users. You will have to store their email and api_key attributes to run the spec harness.
-
In the command line, enter rails console
rails c
And find the two users:
User.all
Take the api_keys for each user and substitute them in for the values here:
export BATTLESHIFT_API_KEY=<API-KEY>
export BATTLESHIFT_EMAIL=test1@test.com
export BATTLESHIFT_OPPONENT_API_KEY=<API-KEY>
export BATTLESHIFT_OPPONENT_EMAIL=test2@test.com
Keep these values close by, you will need them to run the spec harness.
- DatabaseCleaner
- FactoryBot
- Rspec
- ShouldaMatchers
- Doubles
- Factories
- For additional documentation and the individual tests as the suite runs:
--format=documentation
- Additional Useful Flags:
--order=random
--color
The test suite includes test for the following:
- Model Level Testing
These tests can be found in the following folder:
spec/models/
- Request Testing
These tests can be found in the following folders:
spec/requests/api/v1/games
These test test the following categories of endpoints: Model, Relationship, and Business Intelligence.
- In order to run the test suite, from the root project folder simply run:
rspec
- First in the root project folder, spin up your server:
rails s
-
First open another tab in your command line tool.
-
Git clone the spec harness into a folder at the same level as the root of the BattleShift project folder:
git clone https://github.com/turingschool-examples/battleshift_spec_harness
- Main Project Folder
|_ battleshift
|_app
|_bin
|_config
|_...
|_ battleshift_spec_harness
|_spec
|_...
- Change directory into the battleshift_spec_harness folder
cd battleshift_spec_harness
- In the command line tab copy and paste the export variables.
export BATTLESHIFT_API_KEY=RnXQmEvtQj9JCQWOwL210w
export BATTLESHIFT_EMAIL=test1@test.com
export BATTLESHIFT_OPPONENT_API_KEY=THh-kLaFaR-kZMl6o7MGZQ
export BATTLESHIFT_OPPONENT_EMAIL=test2@test.com
- With the server still running in the tab at the root of the project folder, in the other tab (where you're at the root of the spec harness) run:
rspec