-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Airport challenge (Erlantz) #2503
base: main
Are you sure you want to change the base?
Conversation
@@ -0,0 +1,41 @@ | |||
class Airport | |||
|
|||
DEFAULT_CAPACITY = 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a constant? Could you just set your initialized capacity to 1?
|
||
def take_off(plane) | ||
fail 'Plane cannot take off on stormy weather' if weather == "stormy" | ||
fail 'Plane not in this airport' unless plane_in_airport?(plane) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is good. I should have written something similar.
def weather | ||
return "stormy" if rand(20) == 1 | ||
"sunny" | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wrote weather as a new class. Yours is more succinct but since the weather is effectively a different entity to airport and plane, I think it should be it's own class.
allow(subject).to receive(:weather) { "sunny" } | ||
subject.land(plane) | ||
expect(subject.take_off(plane)).to eq ("#{plane} no longer in #{subject} airport") | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is very clear - I like matching to the message.
Erlantz Ramos
Please write your full name here to make it easier to find your pull request.
User stories
Please list which user stories you've implemented (delete the ones that don't apply).
README checklist
Does your README contains instructions for
Here is a pill that can help you write a great README!