- Implement software to control the flow of planes at an airport. The planes can land and take off provided that the weather is sunny. * Occasionally it may be stormy, in which case no planes can land or take off
- Create a set of classes/modules and demonstrate planes taking-off/landing at different airports in different weather conditions
- Ensure full test coverage throughout using the london-style
Your task is to create a set of classes/modules to makes the given test suite pass. You will need to use random number generator to set the weather (it is normally sunny but on rare occasions it may be stormy). In your tests, you'll need to use a double to override random weather. Finally, every plane must have a status indicating whether it's flying or landed.
- Ruby
- Rspec
Clone the repository:
$ git clone git@github.com:leopoldkwok/airport.gitChange into the directory:
$ cd airportHow to run the tests:
$ rspecOpen irb:
$ irbRequire the files:
> require "./lib/Weather.rb"
> require "./lib/airport.rb"
> require "./lib/plane.rb"Create a new airport:
> airport = Airport.newCreate a new plane:
> plane = Plane.newFor a plane to take off:
> plane.take_off!For a plane to land:
> plane.land!