-
Notifications
You must be signed in to change notification settings - Fork 40
Space - Jeta #19
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
base: master
Are you sure you want to change the base?
Space - Jeta #19
Conversation
…rs, Add count nights method and the minitest to
…or the date that we give and the method that calculate the cost of the reservatoin.
HotelSection 1: Major Learning Goals
Section 2: Code Review and Testing Requirements
Section 3: Feature Requirements
Overall Feedback
Additional 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! I am particularly impressed by the way that you tested overlap? using all the examples we went over in class! Also the way you setup appropriate relationships between 4 different classes and made your own error class. Code Style Bonus AwardsWas the code particularly impressive in code style for any of these reasons (or more...?)
|
| end | ||
|
|
||
| def overlap?(other) | ||
| start_date < other.end_date && other.start_date < end_date |
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.
Very clever!
| end | ||
| end | ||
|
|
||
| describe "overlap?" 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.
Great test coverage!
| if !(start_date.is_a? Date) || !(end_date.is_a? Date) | ||
| raise ArgumentError.new("If the start_date and end_date is not a Date") | ||
| end | ||
|
|
||
| if end_date < start_date | ||
| raise ArgumentError.new("If the start_date is biger then the end_date") | ||
| end | ||
|
|
||
| if start_date == end_date | ||
| raise ArgumentError.new("If the start_date date is same with end_date") | ||
| end |
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.
Great validation here!
| it " Rais an argument ArgumentError if end_date is smaller then a start date" do | ||
| start_date = Date.today | ||
| end_date = Date.today - 3 | ||
| expect{Hotel::DateRange.new(start_date, end_date)}.must_raise ArgumentError | ||
| end | ||
|
|
||
| it "is an an error for negative-lenght ranges" do | ||
| start_date = Date.today -5 | ||
| end_date = Date.today | ||
| expect{Hotel::DateRange.new(start_date, end_date)}.must_raise ArgumentError | ||
|
|
||
| end | ||
|
|
||
| it "is an error to create a 0-length range" do | ||
| start_date = Date.today | ||
| end_date = Date.today |
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.
Love that you tested all this on the constructor!
Assignment Submission: Hotel
Congratulations! You're submitting your assignment. Please reflect on the assignment with these questions.
Reflection