Skip to content

Conversation

@ubeninja77
Copy link

Assignment Submission: Hotel

Congratulations! You're submitting your assignment. Please reflect on the assignment with these questions.

Reflection

Question Answer
What was a design challenge that you encountered on this project? I originally had another design in mind. so going from a made from scratch to making sure I pasts test someone else made threw me for a loop. Looking back, I could have omitted a Class to work with only two.
What was a design decision you made that changed over time over the project? I had to look into Wave 2 and decide how I wanted to handle making and storing a reservation in Wave 1
What was a concept you gained clarity on, or a learning that you'd like to share? Making and understanding the variable in my before blocks in my tests. I knew I wanted to add a few tests to practice.
What is an example of a nominal test that you wrote for this assignment? What makes it a nominal case? In the available rooms method, testing to check if a room has a current reservation and then making sure that room is not included in the returned array. A nominal test case because it wills have to run to check if a room is reserved.
What is an example of an edge case test that you wrote for this assignment? What makes it an edge case? In the DateRange class, I added a DatetError if the start/end date overlap. It will raise and error if the dates are invalid and tells the user why it failed.
How do you feel you did in writing pseudocode first, then writing the tests and then the code? I'm slowly getting used to it. I find myself writing mini code i.e # i want to raise ArgumentError "wrong date" here. I'm still telling myself not to become frustrated if the I run a test and it doesn't pass, to deviate from writing pseudocode. Or that the pseudocode is not final, it can be changed.

@ubeninja77 ubeninja77 changed the title Design scaffolding Time - Lola Mar 11, 2020
end_date = @range.end_date
test_range = Hotel::DateRange.new(start_date, end_date)

expect(@range.overlap?(test_range)).must_equal true

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good test for a single test case. The test cases below also need to be completed to insure that .overlap? returns the correct value for the different situations described below.

@date = Date.parse("2020-08-04")
end
describe "wave 1" do
describe "rooms" do

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should keep this test to ensure that a hotel_controller has an array of rooms.


def reservations(date)
return []
def initialize()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This constructor looks great. Make sure to include a test that check that the class is set up correctly.

end
end
describe "reserve_room" do
it "takes two Date objects and returns a Reservation" do

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good test. Nice work! You also need to test edge cases. What if there is no room available?

room_number = 7
rate = 200
reservation = Hotel::Reservation.new(start_date, end_date, room_number, rate)
expect(reservation.cost).must_be_kind_of Numeric

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In addition to checking that cost is Numeric you should check that it is the correct value.

return []
# Wave 1
# creates a reservation of a room for a given date range
def reserve_room(start_date, end_date, room_number, rate)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work implementing this complex logic. To fully tie together reserve_room and available_rooms, ideally reserve_room would not take a room_number as an argument, but instead find an available room by using the available_rooms method.

Raise more exceptions to account for user input error
I would consider trying to make more helper methods
Save the reservations and it's room number in a array of hashes
Get better at writing tests

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your tests look great! However, you need more of them.

I would consider trying to make more helper methods
Save the reservations and it's room number in a array of hashes
Get better at writing tests
Understand how to get the program to pass 95% test coverage

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By clicking on the file name in the index.html file in the coverage directory, you can see which lines of code weren't tested.

end

xdescribe "include?" do
describe "include?" do

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tests below should be completed. This will bring up you test coverage for DateRange

@beccaelenzil
Copy link

Hotel

Section 1: Major Learning Goals

Criteria yes/no, and optionally any details/lines of code to reference
Practices SRP by having at least two separate classes with distinct responsibilities, and test files for these two classes ✔️
Overall, demonstrates understanding instance variables vs. local variables. (There aren't unnecessarily too many instance variables, when it should be a local variable) ✔️
For each test file, tests demonstrate an understanding of instantiating objects properly, and using Arrange-Act-Assert ✔️
Practices pseudocode and TDD, and reflected on it by filling out the reflection questions ✔️
Practices git with at least 15 small commits and meaningful commit messages ✔️

Section 2: Code Review and Testing Requirements

Criteria yes/no, and optionally any details/lines of code to reference
There is a class that represents a reservation, and a second class that holds/manages a collection of reservations through composition (instance variable) ✔️
The logic for checking if a reservation's date overlaps with another reservation's date is complex logic that is separated into method(s) (and potentially class(es)) ✔️
The logic for checking if a reservation's date overlaps with another reservation's date has unit tests These tests are incomplete. See inline comment.
All of the given tests run and pass ✔️
A test coverage tool is installed and used, and shows 95% test coverage Good work installing and using this tool. Note that it shows that Date_Range and Hotel_Controller have insufficient coverage.

Section 3: Feature Requirements

Feature Requirement: There is a method that... yes/no
gives back a list of rooms, and it's tested There is no test for this. See in-line comment
creates a specific reservation for a room for a given date range, and it has nominal test cases ✔️
creates a specific reservation for a room for a given date range, and it tests an edge case, such as no available room, or invalid date range Edge cases are not tests. See in-line comment.
gives back a list of reservations on a given date. Its tests include a test that makes several reservations for a given date There is only a test for making a single reservation
calculates the total price for a reservation ✔️
gives back a list of available rooms for a given date range, and it has nominal test cases ✔️
gives back a list of available rooms for a given date range, and it has edge test cases, such as no available room, or invalid date range Good work testing that it gives all the available rooms when there are not reservations, and reduces this number when there is a reservation. You also need to test edge cases such as no available rooms or invalid date range.
creates a block of rooms Not required per LP
reserves a room from a block No required per LP

Overall Feedback

Overall Feedback Criteria yes/no
Yellow (Approaches Standards) 9-13 total in all sections

Additional Feedback

Great 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!

I am particularly impressed by the way that you worked through complex logic to create helper methods such as available rooms and overlap?. Furthermore, the hotel project is a complex system, and you are clearly meeting the learning goals of using object composition.

I do see some room for improvement around writing comprehensive tests that test multiple nominal and edge cases. I recommend using the coverage report to identify lines of code that haven't been tested. If you're not sure how to address these lines of code, talk to an instructor or TA.

Keep up the hard work!

Code Style Bonus Awards

Was the code particularly impressive in code style for any of these reasons (or more...?)

Quality Yes?
Elegant/Clever
Descriptive/Readable
Logical/Organized

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants