Code Monkey home page Code Monkey logo

battleshift's Introduction

BattleShift

Maintainability Issues License

This project created an API implementation of the game Battleship. After authorization and activation through an email, a player can play against another player through API interactions. To see all the endpoints utilized, in a game look this endpoint explanation. Through utilizing Twilio's API, the game also sends SMS updates after the opponent has taken his or her turn. A deployed version of the api can be visited here.

Table of Contents

Getting Started

These instructions will get you a copy of the battleshift API up and running on your local machine for development and testing purposes.

Prerequisites

  • Ruby, version 2.5
  • Rails, version 5.1.5
  • Puma, version 3.7
  • Rspec-Rails

After cloning down this repository, change into the directory battleshift and run:

bundle

Installing

To setup the database necessary for this API, run the following commands:

rails db:create db:migrate db:seed

Running the tests

In order to run the test suite, run the following command:

bundle exec rspec

Break Down of Test Suite

  • This test suite implements mocks, stubs, doubles, and spies. The following common edge cases in playing a game are tested.
    1. User cannot shoot at a position not on the board
      • rspec spec/requests/api/v1/games/shots_spec.rb
    2. User cannot shoot twice in a row
      • rspec spec/requests/api/v1/games/shots_spec.rb
    3. User cannot shoot after the game is over
      • rspec spec/requests/api/v1/games/shots_spec.rb
    4. User cannot place an extra ship
      • rspec spec/requests/api/v1/games/ships_spec.rb
    5. User cannot place a ship on a location not on the board
      • rspec spec/requests/api/v1/games/ships_spec.rb
    6. User cannot place a ship that in a spot already occupied by another ship
      • rspec spec/requests/api/v1/games/ships_spec.rb
    7. User must place ships in same column or row
      • rspec spec/requests/api/v1/games/ships_spec.rb
    8. User cannot post to a game they’re not playing in
      • rspec spec/requests/api/v1/games/user_cannot_post_to_game_they_are_not_in_spec.rb
    9. Inactive users cannot post to a game
      • spec/requests/api/v1/games/inactive_user_cannot_post_spec.rb
    10. User cannot login in with bad info
      • spec/features/user_can_login_spec.rb

Built With

Contributing

Please feel free to submit pull requests and suggestions to this repository. We would love your feedback.

Authors

Acknowledgments

  • Thanks to our wonderful instructors at Turing

battleshift's People

Contributors

atmavichara avatar jmejia avatar mgmilton avatar s-espinosa avatar

Watchers

 avatar  avatar

Forkers

atmavichara

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.