-
Notifications
You must be signed in to change notification settings - Fork 26
Ports - Kate and Alex #20
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?
Conversation
…ification to come)
…(validation to come)
…viewing trip's cost
Rideshare RailsWhat We're Looking For
|
| } | ||
|
|
||
| expect { | ||
| post trips_path, params: trip_hash |
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 don't have a route for the trips_path instead this should post to the passenger_trips_path
| root to: "homepages#index" | ||
| resources :homepages, only: [:index] | ||
|
|
||
| resources :trips, :drivers, :passengers |
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 should limit the routes trips has, since there's no new trip form, or a trips show page.
| resources :trips, :drivers, :passengers | ||
|
|
||
| resources :drivers do | ||
| resources :trips, only: [:index, :new] |
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.
Trips shouldn't have a new form page, since the trip is created automatically without a form. You also don't have an index page under the driver's show page.
| end | ||
|
|
||
| resources :passengers do | ||
| resources :trips, only: [:index, :new] |
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.
This should be:
resources :passengers do
resources :trips, only: [:create]
end| resources :trips, only: [:index, :new] | ||
| end | ||
|
|
||
| post "/passengers/:passenger_id/trips/", to: "trips#create", as: "create_passenger_trip" |
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 can use resources like above to create this.
| patch trip_path(trip_to_update.id), params: trip_hash | ||
| }.wont_change "Trip.count" | ||
|
|
||
| must_respond_with :redirect |
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 should also verify that the trip's fields change.
| describe "destroy" do | ||
| # Your tests go here | ||
| it "can delete a trip" do | ||
| trip1 = trip |
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.
Why assign trip1 to trip?
|
|
||
| FEE = 165 | ||
| PERCENTAGE = 0.80 | ||
|
|
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.
Having a go_online method wouldn't be bad.
|
|
||
| validates :name, presence: true | ||
| validates :phone_num, presence: true, uniqueness: true | ||
|
|
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.
It would be a good idea to have a request_trip method which generates a trip for an instance of Passenger
| end | ||
|
|
||
| def create | ||
| @trip = Trip.new( |
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.
Some of this business logic could be moved to the Passenger model
Rideshare-Rails
Congratulations! You're submitting your assignment! These comprehension questions should be answered by both partners together, not by a single teammate.
Comprehension Questions