Open
Conversation
Rideshare RailsWhat We're Looking For
|
CheezItMan
reviewed
Apr 26, 2019
|
|
||
| resources :drivers | ||
|
|
||
| resources :trips, except: [:index, :create] |
| # Your tests go here | ||
| end | ||
| end | ||
| # require "test_helper" |
| @@ -1,31 +1,149 @@ | |||
| require "test_helper" | |||
| # require "test_helper" | |||
| cost: 1000, | ||
| }, | ||
| } | ||
| it "can update an existing trip" do |
There was a problem hiding this comment.
What about updating a trip with invalid arguments?
|
|
||
| describe "destroy" do | ||
| # Your tests go here | ||
| it "will respond with not found if invalid id" do |
There was a problem hiding this comment.
What about destroying a valid trip?
| total_money = 0 | ||
|
|
||
| if (trips.length > 0) | ||
| trips.each do |trip| |
| return 0.0 | ||
| end | ||
|
|
||
| trips.each do |trip| |
There was a problem hiding this comment.
You could use .where to get trips with a rating and .sum.
| class Trip < ApplicationRecord | ||
| belongs_to :driver | ||
| belongs_to :passenger | ||
| validates :date, :cost, presence: true |
| @@ -0,0 +1,12 @@ | |||
| class Passenger < ApplicationRecord | |||
| has_many :trips, dependent: :destroy | |||
| class Passenger < ApplicationRecord | ||
| has_many :trips, dependent: :destroy | ||
| validates :name, :phone_num, presence: true | ||
|
|
There was a problem hiding this comment.
I suggest making a model method for a passenger to request a trip.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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