Conversation
HotelWhat We're Looking For
One more minor note. Please don't brake the markdown table in the comprehension questions. |
|
|
||
|
|
||
| end | ||
| end |
There was a problem hiding this comment.
You are missing an end here. Also indentation issues.
| require 'minitest/autorun' | ||
| require 'minitest/reporters' | ||
| require 'minitest/autorun' | ||
| # Add simplecov |
| @@ -0,0 +1,78 @@ | |||
| #Room Class | |||
There was a problem hiding this comment.
This class isn't doing much other than providing an id. So... maybe just use an array of numbers for the rooms.
| end | ||
| total_cost = number_of_days * 200 | ||
| return total_cost | ||
| end |
| @room = room | ||
| @total_cost = calculate_total_cost | ||
| end | ||
|
|
There was a problem hiding this comment.
I would also suggest you add a method to tell if two reservations overlap, and another to tell if a reservation occurs on a specific date.
lib/room_tracker.rb
Outdated
| end | ||
|
|
||
| def make_reservation(start_date, end_date) | ||
| room = @rooms[rand(@rooms.length)] #getavilable room method |
There was a problem hiding this comment.
You should limit this to rooms that are available in the given date range.
| def find_reservations_by_date(date) | ||
| bookings = [] | ||
| @bookings.each do |booking| | ||
| range = booking.start_date..booking.end_date |
There was a problem hiding this comment.
This whole check to see if a Reservation occurs on that date would be wonderful as a helper method in Reservation.
| let (:end_date) { Date.parse('2012-02-03') } | ||
| let (:room) { [14] } | ||
| let (:bookings) {[]} | ||
| it "assigns available room" do |
| hotel.make_reservation(start_date,end_date) | ||
| new_reservation = hotel.bookings.last | ||
| #new_booking = make_reservation(start_date,end_date, room)# new_bookings = Reservation.new(start_date,end_date, 12) | ||
| expect (new_reservation.room).must_equal 14 |
There was a problem hiding this comment.
How do you know it's 14. The reservation picks a random room #.
Hotel
Congratulations! You're submitting your assignment!
Comprehension Questions
Describe a concept that you gained more clarity on as you worked on this assignment. | The importance of testing and how it should inform design.
Describe a nominal test that you wrote for this assignment. | One of the nominal tests that I wrote would be checking to see if I can create a new instance of a class like Room.
Describe an edge case test that you wrote for this assignment. | An edge case I would write would involve how to calculate cost if somebody checks-in and checks-out on the same day.
How do you feel you did in writing pseudocode first, then writing the tests and then the code? | I thought this was a very helpful process. Thinking about the logic first helped me separate figuring out syntax and working on the logic.