-
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
Coral airport_challenge #2494
base: main
Are you sure you want to change the base?
Coral airport_challenge #2494
Conversation
take_off_checks(plane) | ||
@hangar.delete(plane) | ||
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.
The use of private methods really helps with isolating parts of the code that you don't want the user to access.
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 also greatly simplifies the code that the user will be using
let(:plane) { double :plane } | ||
let(:plane2) { double :plane2 } | ||
let(:airport) { Airport.new(5) } | ||
|
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.
Tests have been ordered well with landing tests grouped together first before take off tests
|
||
describe Airport do | ||
let(:plane) { double :plane } | ||
let(:plane2) { double :plane2 } |
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.
Use single line syntax for setting doubles with their own methods and return values in each unit test to make code more DRY
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.
Can also take that a step further by using a "before do" bock of code to set the doubles and method results for all subsequent tests
@capacity = capacity | ||
@weather = Weather.new | ||
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.
Methods were kept very short which makes them easier to understand
|
||
it 'returns true if theres a storm.' do | ||
expect(subject.storm?).to be(true).or be(false) | ||
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.
Use "srand" to remove the random number generation and set the weather to what you want in the test
Coral Baker
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!