-
Notifications
You must be signed in to change notification settings - Fork 28
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
Michelle and Katrina - Edges - OO-Ride-Share #23
base: master
Are you sure you want to change the base?
Conversation
should we resolve conflicts?? specs/driver_spec.rb |
Ride ShareWhat We're Looking For
|
def net_expenditures() | ||
valid_trips = @trips.reject { |trip| trip.cost.nil? } | ||
return valid_trips.sum { |trip| trip.cost} if valid_trips.length > 0 | ||
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 use of enumerables through here!
describe "user#net_expenditures" do | ||
before do | ||
@user = RideShare::User.new(id: 9, name: "Merl Glover III", | ||
phone: "1-602-620-2330 x3723", trips: []) |
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.
I think you're missing some edge cases that are common to both these User
methods:
- What happens if the user has no trips?
- What happens if the user has an incomplete trip?
|
||
if !(super.nil? && total_driver_revenue.nil?) | ||
return ("%.2f" % (super - total_driver_revenue)).to_f | ||
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.
Good use of super
here
end | ||
end | ||
|
||
describe "average_rating method" do | ||
describe "net_expenditures" do | ||
before do | ||
@driver = RideShare::Driver.new(id: 54, name: "Rogers Bartell IV", |
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.
You're missing some interesting cases here. What if a driver has
- No driven trips
- No trips as a passenger
- An incomplete trip as either a driver or passenger
- Made more money than they've spent
def request_trip(user_id) | ||
current_passenger = find_passenger(user_id) | ||
available_driver = @drivers.find { |driver| driver.status == :AVAILABLE } | ||
|
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.
You're not screening for getting the same person who requested this trip
|
||
describe 'Request Trip Method ' do | ||
before do | ||
@dispatcher = RideShare::TripDispatcher.new(USER_TEST_FILE, TRIP_TEST_FILE, DRIVER_TEST_FILE) |
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.
What happens if there are no drivers available?
OO Ride Share
Congratulations! You're submitting your assignment!
Comprehension Questions
User
andDriver