Conversation
…tions overall. Created and passed all reservation initialization tests.
… passed for that item.
…lect changes to fix bugs.
…elblocks. not done yet.
…nputs to date object inputs.
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! In particular nice work implementing Wave 3. Your use of inheritance for HotelBlock and the change_status method are quite clever. |
| @@ -0,0 +1,2 @@ | |||
| class FullOccupancyError < StandardError | |||
There was a problem hiding this comment.
This is a great example of defining your own appropriately named exception type.
|
|
||
| # Returns only reservations and not hotel blocks as per specs. | ||
| def list_reservations | ||
| return @occupied.values.select { |value| value.class == Hotel::Reservation } |
There was a problem hiding this comment.
Ruby will be looking for names locally first, prioritizing local names, since they're all in the same module, there's no need to namespace Hotel::Reservation. Reservation should just work! Same with the rest of the namespacing in the code.
|
|
||
| # Returns only reservations and not hotel blocks as per specs. | ||
| def list_reservations | ||
| return @occupied.values.select { |value| value.class == Hotel::Reservation } |
| require_relative 'reservation' | ||
|
|
||
| module Hotel | ||
| class HotelBlock < Reservation |
| attr_reader :rooms, :reservations, :dates, :hotelblocks | ||
|
|
||
| def initialize | ||
| @rooms = Hotel::Room.generate_rooms |
| def initialize | ||
| @rooms = Hotel::Room.generate_rooms | ||
| @reservations = [] | ||
| @dates = [] |
There was a problem hiding this comment.
A comment to tell us what @dates is meant to hold would be useful, as it's not immediately obvious.
| expect(@first_res).must_be_instance_of Hotel::Reservation | ||
|
|
||
| expect(@first_res.id).must_equal 1 | ||
| expect(@first_res.start_date).must_equal ::Date.parse('2019-06-05') |
There was a problem hiding this comment.
Consider assigning dates to variables in your tests to make it clear what you are testing.
| expect(@first_res.start_date).must_equal ::Date.parse('2019-06-05') | |
| start_date = Date.parse('2019-06-05') | |
| end_date = start_date + 3 |
Hotel
Congratulations! You're submitting your assignment!
Comprehension Questions