Skip to content
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

Sai's ride share #23

Open
wants to merge 43 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
284b1e2
set up code and spec files, added code to Rakefile
ssamant Mar 7, 2017
f628f34
set up code and spec files, updated Rakefile
ssamant Mar 7, 2017
71ed425
added pseudocode for drivers.rb
ssamant Mar 7, 2017
6ba6cf9
added pseudocode for rider
ssamant Mar 7, 2017
d61c1dc
renamed files to be singular (e.g. rider instead of rider)
ssamant Mar 7, 2017
3b15442
added pseudocode for trip.rb
ssamant Mar 7, 2017
e53775b
changed names of spec files
ssamant Mar 7, 2017
bf4ca34
added describe and it blocks to trip_spec
ssamant Mar 7, 2017
7f6161e
added describe/it blocks for rider_spec
ssamant Mar 7, 2017
11931ec
add .gitignore file
ssamant Mar 7, 2017
45557a7
added coverage dir to .gitgnore
ssamant Mar 7, 2017
9ca794e
find and all methods added to rider
ssamant Mar 7, 2017
67e9e14
updated specs to include pry
ssamant Mar 7, 2017
6a3a16e
WIP trip code and tests
ssamant Mar 7, 2017
f678089
code for trip.rb done. driver-side tests needed in spec file
ssamant Mar 7, 2017
a2cec74
WIP mostly fixed a big mess with return nil in many find methods
ssamant Mar 7, 2017
b7ce526
added rating code and tests to driver
ssamant Mar 7, 2017
834fd6e
code and tests for driver and trips methods in rider class
ssamant Mar 7, 2017
a61ac3e
added new Error in StandardError class
ssamant Mar 8, 2017
ed8923c
ignore support files
ssamant Mar 8, 2017
fa39fee
WIP trying to work on edge cases and error checking
ssamant Mar 8, 2017
1593da9
taking csv file out of all and passing it as a parameter (so can test…
ssamant Mar 8, 2017
daf853e
rescue bad VINs for drivers and test for it (dummy vin added to line …
ssamant Mar 8, 2017
1712572
ignore these files
ssamant Mar 8, 2017
e013493
working on tests for error checking at initialize driver class
ssamant Mar 8, 2017
dd3800c
WIP updating tests and working on edge cases across classes
ssamant Mar 8, 2017
a3a3ea7
trip initialize takes hash and specs updated for hash
ssamant Mar 9, 2017
fc28049
stop tracking trips.csv
ssamant Mar 9, 2017
316f6d7
added minitest skip_dsl to spec_helper
ssamant Mar 9, 2017
d799ed7
trying to delete trips.csv
ssamant Mar 9, 2017
40c823b
fixed some formatting in trip.rb
ssamant Mar 9, 2017
126e454
updated rider.rb to initialize with hash
ssamant Mar 9, 2017
27eda27
driver.rb initializes with hash and tests pass
ssamant Mar 9, 2017
02e2185
added add_driver class method to add a driver to the csv file
ssamant Mar 10, 2017
8e67b05
updated driver_specs for add_driver method
ssamant Mar 10, 2017
1a1725d
added rider methods and tests for cost and duration; added cost and d…
ssamant Mar 12, 2017
6660194
trip and specs updated with minor edits
ssamant Mar 12, 2017
7f272cd
finished tests for rider
ssamant Mar 12, 2017
74701b5
finished up tests for driver class
ssamant Mar 12, 2017
62cbf72
forgot to write tests for moneys method in driver class! (added now)
ssamant Mar 12, 2017
9542f84
added constants to driver for calculating driver pay
ssamant Mar 13, 2017
ef31bcf
dried up rescue in all method in Driver
ssamant Mar 14, 2017
f549beb
dried up code for all methods in driver and trip based on kari's feed…
ssamant Mar 14, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
code for trip.rb done. driver-side tests needed in spec file
  • Loading branch information
ssamant committed Mar 7, 2017

Verified

This commit was signed with the committer’s verified signature.
commit f6780897dafe4ddad472f30a5dc28af36226ff84
13 changes: 12 additions & 1 deletion lib/trip.rb
Original file line number Diff line number Diff line change
@@ -35,16 +35,27 @@ def self.find_trips_by_rider rider_id
#search by rider_id to return array of Trip instances associated with that rider
end

def self.find_trips_by_driver
def self.find_trips_by_driver driver_id
all_trips = Trip.all
driver_trips = all_trips.find_all { |trip| trip.driver_id == driver_id }
if driver_trips.length > 0
return driver_trips
else
return nil
end
#call all
#search by driver to return array of Trip instances associated with that driver
end

def driver
driver_info = Diver.find @driver_id
return driver_info
#call Driver.find to return Driver instance associated with the driver_id of the trip instance
end

def rider
rider_info = Rider.find @rider_id
return rider_info
#call Rider.find to return Rider instance associated with the rider_id of the trip instance
end

22 changes: 13 additions & 9 deletions specs/trip_spec.rb
Original file line number Diff line number Diff line change
@@ -35,10 +35,6 @@

describe "find_trips_by_rider" do
it "takes a rider_id" do

end

it "raises/does something if it can't find that rider id" do
skip
end

@@ -63,8 +59,6 @@
rider_trips.must_be_instance_of NilClass
end
#all rider_ids must match the passed argument


end

describe "find_trips_by_Driver" do
@@ -95,9 +89,19 @@

describe "rider" do
it "returns a Rider instance" do
end

it "lets you know if it doesn't have the rider info" do
trip = trips[23]
rider_info = trip.rider
rider_info.must_be_instance_of RideShare::Rider
rider_info.id.must_equal trip.rider_id
rider_info.id.must_equal 280
# CSV file: 24,75,280,2015-11-04,4
end

it "returns nil if the rider isn't found" do
#don't think this is possible to test through current CSV files?
trip = RideShare::Trip.new(6500, 727272, 7845, "2016-12-29", 4)
rider_info = trip.rider
rider_info.must_be_instance_of NilClass
end
end