Skip to content

jackmcc08/boris_bikes_jack_max

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BORIS BIKES by Max and Jack | Makers Week 1

Create a program that creates a network of docking stations and bikes that anyone can do.

Build Status

This program is a fork of crotcheycrows repo where challenges 1 through 9 (almost) were completed.

Update (end Wednesday): Max and I got to end of challenge 13.

CHALLENGES COMPLETED

  1. Setting up a project
  • Create a directory from the command line
  • Initialise a git repository within that directory
  • Create a README.md file from the command line
  • Write a clear README
  • Add the README.md to the staging area
  • Commit your changes with a clear message
  • Push the project to Github.

DONE#

  1. From user stories to a domain model
  • Write down all the nouns in the User Stories
  • Write down all the verbs in the User Stories
  • Draw a table like the one above
  • Organise the nouns and verbs into Objects and Messages within the table
  • Draw a diagram that shows how your Objects will use Messages to communicate with one another

DONE#

  1. From a Domain Model to a Feature Test
  • Start irb (or any other REPL) from the Command Line
  • Set a variable docking_station equal to a new DockingStation object
  • Explain to your pair partner what the resulting error means.
    • error message essentially said that the constant did not exist and could not be found in the ruby language, the irb or any gems.

DONE#

  1. Errors are good
  • Write down the type of error
    • uninitalized constant
  • Write down the file path where the error happened
    • /Users/jackmccarthy/.rvm/rubies/ruby-2.7.2/bin/irb:23:in
  • Write down the line number of the error
    • Line 1 (in IRB)
  • Use the Ruby Documentation to find out what the error means
    • the Constant has not been defined
  • Suggest one way of solving the error.
    • Create a constant !

DONE#

  1. From Feature Test to unit Test
  • Initialise RSpec within your project
  • Create a new spec file for your DockingStation object
  • Set up the spec file to describe a DockingStation
  • Run RSpec from the Command Line
  • Explain to your pair partner the difference between this error and the error you saw before.
    • No method created to release the bike

DONE#

  1. Passing your first Unit Test
  • Create a new file for a Docking Station class, inside the /lib directory
  • Define a DockingStation class
  • Use require to include this file inside your spec file
  • Run RSpec from the Command Line
  • Explain to your pair partner the difference between what you see, and the error you saw before.

DONE#

  1. Back to the feature
  • Start irb (or any other REPL) from the Command Line
  • Use require to include the file that contains the DockingStation class definition
  • Set a variable docking_station equal to a new DockingStation object
  • Explain to your pair partner why you do not see an error now, when you did before
  • Ask the docking_station instance to release_bike
  • Explain to your pair partner what the resulting error means.

DONE#

  1. Back to the Unit
  • Add a test to your spec file that expects DockingStation instances to respond_to the method release_bike
  • Rewrite this test using RSpec's one-liner syntax
  • Run RSpec from the Command Line
  • Explain the error to your pair partner
    • no method release_bike, so cannot find it
  • Add a method release_bike to the DockingStation class
  • Run RSpec from the Command Line
  • Explain to your pair partner the difference between what you see, and the error you saw before.
    • we now have a method so it finds it and can run the test

DONE#

  1. Building a bike
  • Start irb (or another REPL such as 💊 Pry)
  • Instantiate a DockingStation as docking_station
  • Ask docking_station to release a bike, and save the response to a variable bike
    • Max fixed - changed docking station to create a new bike object.
  • Ask the bike if it is working?
  • Explain the error to your pair partner
    • unable to find method .working?, no Bike class
  • Create a new spec file for a Bike class
  • Set up the spec file to describe the Bike class
  • Run RSpec from the Command Line
  • Fix the error you see, similarly to how you fixed the same error for DockingStation
  • Add a test to your bike_spec.rb file that expects Bike instances to respond_to the method working?
  • Make this test pass.

DONE#

  1. Making Docking Stations Release Bikes
  • Feature-test the feature you are building using irb
  • Explain the error to your pair partner
  • Add a test to your DockingStation specification that a) gets a bike, and then b) expects the bike to be working
  • Make this test pass
  • Feature-test the feature again.

DONE#

  1. Using Instance Variables
  • Write a feature test for docking a bike at a docking station
  • Write a unit test for the method you need to add to DockingStation to make docking possible
    • When unit test run, .doc_bike return the bike id to us
  • Pass both tests
  • Use an instance variable with attr_reader to do a full test-implementation cycle for the second User Story above
    • added tests which docked a bike, checked bike was included in the bikes array, and inspected the bikes array

As a member of the public So I can return bikes I've hired I want to dock my bike at the docking station

objects ------- messages

user
bike is_returned? dockings station docks.bike

As a member of the public So I can decide whether to use the docking station I want to see a bike that has been docked

objects -------- messages

user docking station List.bikes docking_station.List specific_bike

DONE#

  1. Raising Exceptions
  • Feature test the feature you are building using irb
  • Use {} and raise_error syntax in your RSpec unit test to test exception raising
  • Use the fail or raise keyword to raise an exception in your code (not your tests)
  • Make the test pass by raising an exception
  • Explain why you use curly braces in the RSpec error handling syntax to your partner
  • Feature-test the feature again.

As a member of the public, So that I am not confused and charged unnecessarily, I'd like docking stations not to release bikes when there are none available.

Object ------------------ Message

User docking_station.bike true? OR false docking)station release_bike? error

DONE#

  1. Limiting Capacity
  • Deliver the feature above in a Test-Driven manner

As a maintainer of the system, So that I can control the distribution of bikes, I'd like docking stations not to accept more bikes than their capacity.

objects ---------------- Message Maintainer docking_station.bike == 1 docking_station.dock_bike fail

Write RSpec tests that expect errors Use fail or raise to raise an error Use a 'guard condition'

DONE#

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 100.0%