-
Notifications
You must be signed in to change notification settings - Fork 50
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
Leaves - Yitgop #37
base: master
Are you sure you want to change the base?
Leaves - Yitgop #37
Conversation
…to Booker, and "total_cost" to Reservation
HotelWhat We're Looking ForTest Inspection
Code Review
Overall FeedbackGreat work overall! You've built your first project with minimal starting code. This represents an incredible milestone in your journey, and you should be proud of yourself! Your code is clear and your design helps you achieve all the requirements. |
@rooms = [] | ||
@reservations = [] | ||
|
||
if @inventory.class != Integer |
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 error checking should go ahead of the assignment to @inventory
lib/booker.rb
Outdated
|
||
end | ||
|
||
def all_rooms |
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.
How is this different than the rooms
reader method.
test/booker_test.rb
Outdated
|
||
end | ||
|
||
describe "all_rooms method" do |
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 like this inventory feature, but your hotel was supposed to have 20 rooms.
|
||
it "throws ArgumentError when there is no available rooms during the given date range" do | ||
rooms = @new_booker.rooms | ||
rooms[0].bookings << Hotel::Reservation.new(check_in: "2019-09-01", check_out: "2019-09-04", room: 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.
Consider storing the dates in variables so it is clear what you are testing.
rooms[0].bookings << Hotel::Reservation.new(check_in: "2019-09-01", check_out: "2019-09-04", room: 1) | |
check_in_date = "2019-09-01" | |
check_out_date = "2019-09-04" |
test/room_test.rb
Outdated
expect(Hotel::Room.new(number: 3).bookings.length).must_equal 0 | ||
end | ||
|
||
# it "adds booking to the bookings array if provided" do |
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.
remove commented code
expect(Hotel::Reservation.new(check_in: check_in, check_out: check_out).room).must_equal nil | ||
end | ||
|
||
it "is set up for specific attributes and data types" do |
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.
nice separation of Act/Arrange/Assert in this test.
it "sets room to nil if not provided" do | ||
check_in = "2019-09-01" | ||
check_out = "2019-09-04" | ||
expect(Hotel::Reservation.new(check_in: check_in, check_out: check_out).room).must_equal nil |
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 think there's a .must_equal_nil method.
|
||
end | ||
|
||
describe "make_reservation method" do |
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.
Nice, comprehensive tests.
Hotel
Congratulations! You're submitting your assignment!
Comprehension Questions