Conversation
|
I was only able to complete wave 1 |
HotelWhat We're Looking For
|
| @@ -0,0 +1,57 @@ | |||
| require_relative 'spec_helper' | |||
There was a problem hiding this comment.
This filename is wrong. Check out the Rakefile the file name should end with _spec.rb not _specs.rb
Otherwise good initial set of tests
| end | ||
| return @reservations | ||
| end | ||
| end |
There was a problem hiding this comment.
You are missing an end check your indentation!
|
|
||
| def reserve_room(check_in, check_out, room_num) | ||
| #reserves a room for a given date range | ||
| in = Date.parse(check_in) |
There was a problem hiding this comment.
You are using a keyword here, in means something special in Ruby so you can't use it for a variable name.
| out = Date.parse(check_out) | ||
| @range = (out - in) | ||
|
|
||
| if @reservations[@rooms.last] == room_num |
There was a problem hiding this comment.
I'm not sure what this if statement is trying to accomplish. I think what you want to do is loop through all your reservations and check to see if:
- The reservation has the same room number and
- The dates conflict with the dates given as arguments.
If none do, then you can create a new reservation instance and add that to the list of reservations. Otherwise indicate an error.
However this really isn't the job of an individual Reservation instance (the method here is in the wrong class). Instead making reservations is a job of some kind of booking manager. A Reservation class should describe all the things you could ask an individual reservation (does it conflict with a given date range, what's the room #, how much does it cost etc).
| end | ||
|
|
||
|
|
||
| def total_cost_reservation(check_in, check_out) |
| @@ -0,0 +1,5 @@ | |||
| { | |||
| end | ||
|
|
||
| it "reserve_room method returns a hash" do | ||
| expect(@reservation.reserve_room).must_be_kind_of Hash |
There was a problem hiding this comment.
Why would reserve_room return a hash? Also would you ask a reservation instance to reserve a room?
|
|
||
| def set_up_reservations #sets reservation's key to room #s | ||
| @reservations = {} | ||
| @reservations.each do |key, value| |
There was a problem hiding this comment.
What is this method trying to do? Why have a hash of reservations and why have each element point to a list of all the rooms.
Hotel
Congratulations! You're submitting your assignment!
Comprehension Questions