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.
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.
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.
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.
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.
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.
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 |
|
|
||
| FEE = 165 | ||
| PERCENTAGE = 0.80 | ||
|
|
There was a problem hiding this comment.
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.
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.
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