Makers Academy | Week 3 | Friday Challenge |
---|
The aim of this challenge is to model the flow of planes in an airport. This used a set of classes/modules and used doubles for testing.
- A plane can take off and land
- A random weather generator can set the weather
- An airport can tell a plane whether it can take off or land, depending on the airport's capacity and current weather
- Ruby
- Rspec
Screenshot of test results from terminal:
Clone the repository:
$ git clone git@github.com:michballard/airport-challenge.git
Change directory:
$ cd airport-challenge/
Open up IRB and require file:
> require './run_airport.rb'
####Methods available in this project
To create new objects:
> plane = Plane.new
> airport = Airport.new
For a plane to take off:
> plane.take_off!
For a plane to land:
> plane.land!
To land a plane at an airport:
> airport.accept(plane)
To release a plane from airport:
> airport.release(plane)
To check status of a plane:
> plane.plane_status # can either be flying or landed
To check capacity of airport:
> airport.capacity # gives total capacity
> airport.planes # lists all planes currently landed at airport
> airport.full?
> airport.empty?
To check weather:
> airport.weather # can either be sunny or stormy