Code Monkey home page Code Monkey logo

anubiskhan / battleshift Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nergdnvlt-zz/battleshift

0.0 1.0 0.0 135 KB

Originally a brownfield project which had been designed intentionally to have tech debt, superfluous code, and broken interactions. We converted it from a non-functional player vs computer battle ship game to a functioning, cleaner player vs player battleship game utilizing a RESTful API to place ships and make moves.

Ruby 89.49% JavaScript 1.28% CSS 0.98% HTML 8.25%

battleshift's Introduction

README

BattleShift

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

Table Of Contents

Versions/Prerequisites


Main:

To Install and run this application please be aware of the following versions and requirements:

  • PostgreSQL 10+
  • Rails 5+
  • Ruby 2.4+
Secondary:
  • ActiveRecord
  • ActiveModelSerializers
  • PG
  • Puma

Setup


  • 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 [email protected]
export BATTLESHIFT_OPPONENT_API_KEY=<API-KEY>
export [email protected]

Keep these values close by, you will need them to run the spec harness.


The Test Suite


Test Information

Test Suite Components:
Gems
  • DatabaseCleaner
  • FactoryBot
  • Rspec
  • ShouldaMatchers
Approaches
  • Doubles
  • Factories

Test Documentation and Tweaks

  • For additional documentation and the individual tests as the suite runs:
--format=documentation
  • Additional Useful Flags:
--order=random
--color
About The Tests:

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.

Running The Suite:
  • In order to run the test suite, from the root project folder simply run:
rspec

Running the Spec Harness


Spin up a Server:

  • First in the root project folder, spin up your server:
rails s

Clone down the Spec Harness:

  • 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

Export the environment variables:

  • In the command line tab copy and paste the export variables.
export BATTLESHIFT_API_KEY=RnXQmEvtQj9JCQWOwL210w
export [email protected]
export BATTLESHIFT_OPPONENT_API_KEY=THh-kLaFaR-kZMl6o7MGZQ
export [email protected]

Running the harness:

  • 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

Authors

battleshift's People

Contributors

anubiskhan avatar tlvndgren avatar jmejia avatar s-espinosa avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.