From c86ee8851ceca007fe0c2e25a5955322cd4098b2 Mon Sep 17 00:00:00 2001 From: Sam Joseph Date: Tue, 24 Nov 2015 10:18:52 +0000 Subject: [PATCH 1/3] updates README user stories for consistency --- README.md | 46 +++++++++++++++++++--------------------------- 1 file changed, 19 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index f6eec448f8..08606d18a3 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Instructions Steps ------- -1. Fill out your learning plan self review for the week: https://github.com/makersacademy/learning_plan_october2015 (edit week 1 - you can edit directly on Github) +1. Fill out your learning plan self review for the week: https://github.com/makersacademy/learning_plan_november2015 (edit week 1 - you can edit directly on Github) 2. Fork this repo, and clone to your local machine 3. run the command `gem install bundle` 4. When the installation completes, run `bundle` @@ -25,44 +25,36 @@ Task We have a request from a client to write the 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. Here are the user stories that we worked out in collaboration with the client: ``` -As an air traffic controller -So planes can land safely at my airport -I would like to instruct a plane to land +As an air traffic controller +So I can get passengers to a destination +I want to instruct a plane to land at an airport and confirm that it has landed -As an air traffic controller -So planes can take off safely from my airport -I would like to instruct a plane to take off +As an air traffic controller +So I can get passengers on the way to their destination +I want to instruct a plane to take off from an airport and confirm that it is no longer in the airport -As an air traffic controller -So that I can avoid collisions -I want to prevent airplanes landing when my airport if full +As an air traffic controller +To ensure safety +I want to prevent takeoff when weather is stormy -As an air traffic controller -So that I can avoid accidents -I want to prevent airplanes landing or taking off when the weather is stormy +As an air traffic controller +To ensure safety +I want to prevent landing when weather is stormy -As an air traffic controller -So that I can ensure safe take off procedures -I want planes only to take off from the airport they are at +As an air traffic controller +To ensure safety +I want to prevent landing when the airport is full As the system designer So that the software can be used for many different airports I would like a default airport capacity that can be overridden as appropriate +``` -As an air traffic controller -So the system is consistent and correctly reports plane status and location -I want to ensure a flying plane cannot take off and cannot be in an airport +Your task is to test drive the creation of a set of classes/modules to satisfy all the above user stories. You will need to use a 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 stub to override random weather to ensure consistent test behaviour. -As an air traffic controller -So the system is consistent and correctly reports plane status and location -I want to ensure a plane that is not flying cannot land and must be in an airport -As an air traffic controller -So the system is consistent and correctly reports plane status and location -I want to ensure a plane that has taken off from an airport is no longer in that airport -``` +Your code should defend against inconsistent states of the system ensuring that planes can only take off from airports they are in; planes that are already flying cannot takes off and/or be in an airport; planes that are landed cannot land again and must be in an airport. -Your task is to test drive the creation of a set of classes/modules to satisfy all the above user stories. You will need to use a 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 stub to override random weather to ensure consistent test behaviour. For overriding random weather behaviour, please read the documentation to learn how to use test doubles: https://www.relishapp.com/rspec/rspec-mocks/docs . There’s an example of using a test double to test a die that’s relevant to testing random weather in the test. From 4146852c998a29734907259e7dc646764ff48296 Mon Sep 17 00:00:00 2001 From: Sam Joseph Date: Tue, 24 Nov 2015 10:37:58 +0000 Subject: [PATCH 2/3] adds first draft of more detail on the requirements --- README.md | 45 +++++++++++++++++++++++++++++++++++---------- 1 file changed, 35 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 08606d18a3..72efadb83f 100644 --- a/README.md +++ b/README.md @@ -15,16 +15,20 @@ Steps 1. Fill out your learning plan self review for the week: https://github.com/makersacademy/learning_plan_november2015 (edit week 1 - you can edit directly on Github) 2. Fork this repo, and clone to your local machine -3. run the command `gem install bundle` +3. Run the command `gem install bundle` 4. When the installation completes, run `bundle` 3. Complete the following task: Task ----- -We have a request from a client to write the 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. Here are the user stories that we worked out in collaboration with the client: +We have a request from a client to write the software to support an air traffic controller managing 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. Here are the user stories that we worked out in collaboration with the client: ``` +As an air traffic controller +So I can provide waiting passengers with information +I want to ask a plane if it has landed + As an air traffic controller So I can get passengers to a destination I want to instruct a plane to land at an airport and confirm that it has landed @@ -52,19 +56,40 @@ I would like a default airport capacity that can be overridden as appropriate Your task is to test drive the creation of a set of classes/modules to satisfy all the above user stories. You will need to use a 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 stub to override random weather to ensure consistent test behaviour. - -Your code should defend against inconsistent states of the system ensuring that planes can only take off from airports they are in; planes that are already flying cannot takes off and/or be in an airport; planes that are landed cannot land again and must be in an airport. - - For overriding random weather behaviour, please read the documentation to learn how to use test doubles: https://www.relishapp.com/rspec/rspec-mocks/docs . There’s an example of using a test double to test a die that’s relevant to testing random weather in the test. +Your code should defend against inconsistent states of the system ensuring that planes can only take off from airports they are in; planes that are already flying cannot take off and/or be in an airport; planes that are landed cannot land again and must be in an airport. + Please create separate files for every class, module and test suite. -The submission will be judged on the following criteria: +The submission will be reviewed using the following criteria: + +* Supporting Files: + * [ ] README has been updated with description of your approach + * [ ] README has been updated with 'how to use' instructions +* Testing set up: + * [ ] Uses named subject with `described_class` + * [ ] Uses `context` and `describe` blocks to create test scopes + * [ ] Avoids vacuous tests + * [ ] Sufficient [Test coverage](https://github.com/makersacademy/course/blob/master/pills/test_coverage.md) + * [ ] Use `before` blocks to set up objects rather than repeat code + * [ ] Avoids multiple `expect`s in `it` block + * [ ] Handles randomness in tests + * [ ] Gets rid of redundant `respond_to` expectations + * [ ] Tests all green +* Application Code: + * [ ] Naming conventions match the domain model + * [ ] Has no commented out code + * [ ] Conditionals are refactored + * [ ] Uses implicit return of booleans + * [ ] Does not expose internal implementation + * [ ] Classes and methods have clear single responsibilities + * [ ] Methods are short + * [ ] Avoids magic numbers + * [ ] Prefers symbols to strings + * [ ] Methods are named as commands OR queries + * [ ] Avoids redundant lines of code -* Tests pass -* [Test coverage](https://github.com/makersacademy/course/blob/master/pills/test_coverage.md) is good -* The code is elegant: every class has a clear responsibility, methods are short etc. **BONUS** From e5e49934c7ddeaee80103c587f8e68bd03d00932 Mon Sep 17 00:00:00 2001 From: Sam Joseph Date: Tue, 24 Nov 2015 14:18:48 +0000 Subject: [PATCH 3/3] brings requirements into line with rubric --- README.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 72efadb83f..a5a0cf0a73 100644 --- a/README.md +++ b/README.md @@ -70,17 +70,17 @@ The submission will be reviewed using the following criteria: * Testing set up: * [ ] Uses named subject with `described_class` * [ ] Uses `context` and `describe` blocks to create test scopes - * [ ] Avoids vacuous tests - * [ ] Sufficient [Test coverage](https://github.com/makersacademy/course/blob/master/pills/test_coverage.md) + * [ ] Avoids Vacuous tests * [ ] Use `before` blocks to set up objects rather than repeat code + * [ ] Sufficient [Test coverage](https://github.com/makersacademy/course/blob/master/pills/test_coverage.md) * [ ] Avoids multiple `expect`s in `it` block * [ ] Handles randomness in tests - * [ ] Gets rid of redundant `respond_to` expectations + * [ ] Eliminates redundant `respond_to` expectations * [ ] Tests all green * Application Code: * [ ] Naming conventions match the domain model * [ ] Has no commented out code - * [ ] Conditionals are refactored + * [ ] Conditionals are refactored to minimum possible * [ ] Uses implicit return of booleans * [ ] Does not expose internal implementation * [ ] Classes and methods have clear single responsibilities @@ -88,6 +88,7 @@ The submission will be reviewed using the following criteria: * [ ] Avoids magic numbers * [ ] Prefers symbols to strings * [ ] Methods are named as commands OR queries + * [ ] Makes correct use of attr_* methods * [ ] Avoids redundant lines of code