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

Queues - Cara Comfort - RideShare 2 #35

Open
wants to merge 36 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
03f5be1
Content added to Rakefile
cecomfort Mar 7, 2017
bc22c1c
Added driver file
cecomfort Mar 7, 2017
43dfc31
Added trip file
cecomfort Mar 7, 2017
1a6be89
Added rider file
cecomfort Mar 7, 2017
5ec6a96
Added spec files for classes
cecomfort Mar 7, 2017
f2a2db0
Past first initialize test for Driver
cecomfort Mar 7, 2017
288b9bc
Added spec_helper to spec files
cecomfort Mar 7, 2017
63d03c6
Driver -> takes a name, VIN, and ID
cecomfort Mar 7, 2017
a959e5f
Added InvalidVinError class
cecomfort Mar 7, 2017
8ca1d89
driver raises InvalidVinError for invalid vin
cecomfort Mar 7, 2017
a43a90a
Outlined rest of Driver spec tests
cecomfort Mar 7, 2017
c9e26fc
Driver.all returns an array
cecomfort Mar 7, 2017
ee1ce68
Driver.all returns array of driver objs
cecomfort Mar 7, 2017
2a2eaaf
Driver.all returns the correct number of drivers
cecomfort Mar 7, 2017
0eef503
completed Driver.all and Driver.find
cecomfort Mar 8, 2017
e85e321
Rider -> constructor tests
cecomfort Mar 8, 2017
7831a08
Rider -> initialize defined
cecomfort Mar 8, 2017
687b478
Rider -> outlined spec tests
cecomfort Mar 8, 2017
c327831
Rider -> self.all
cecomfort Mar 8, 2017
64b27d3
Rider -> Rider.find complete
cecomfort Mar 8, 2017
6dcb373
Trip -> can be instantiated with args
cecomfort Mar 8, 2017
ef610b1
Trip -> rating must be an int
cecomfort Mar 8, 2017
37a20e5
Renamed invalid_vin_error to custom_errors
cecomfort Mar 8, 2017
012b804
Cutom_errors -> defined invalid rating error
cecomfort Mar 8, 2017
35a531c
Driver -> VIN must be a string
cecomfort Mar 8, 2017
107a568
Trip-> driver method complete
cecomfort Mar 8, 2017
64939a4
Trip -> rider method complete
cecomfort Mar 8, 2017
59ab5bb
Trip -> self.all complete
cecomfort Mar 10, 2017
951d3e9
Trip -> find_all_for_driver returns an array of Trips
cecomfort Mar 10, 2017
313952a
Trip -> find_all_for_driver returns correct trips from csv file
cecomfort Mar 10, 2017
507183c
Trip -> find_all_for_rider complete
cecomfort Mar 10, 2017
34f25cc
Driver -> Trips method complete
cecomfort Mar 11, 2017
c177ebd
Rider -> Trips method compelte
cecomfort Mar 11, 2017
bc09482
Driver -> avg rating complete
cecomfort Mar 11, 2017
aa7ad95
Rider -> wrote tests for drivers method
cecomfort Mar 13, 2017
40e09d3
Rider -> drivers method complete
cecomfort Mar 13, 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
Outlined rest of Driver spec tests
cecomfort committed Mar 7, 2017

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit a43a90aa46315ade8d2cdc52fe357a48db7d53e0
2 changes: 2 additions & 0 deletions lib/driver.rb
Original file line number Diff line number Diff line change
@@ -15,6 +15,8 @@ def initialize(args)
@vin = args[:vin]
end




private

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good use of private to hide methods not part of your API.


99 changes: 64 additions & 35 deletions specs/driver_spec.rb
Original file line number Diff line number Diff line change
@@ -1,41 +1,6 @@
require_relative 'spec_helper'

describe "Driver" do
# describe "constructor" do
# let (:driver) {RideShare::Driver.new(name: 'Ada', id: 108, vin: '123456789abcdefeg')}
#
# it "can be instantiated" do
# driver.must_be_instance_of RideShare::Driver
# end
#
# it "takes a name, VIN, and ID" do
# driver.must_respond_to :name
# driver.name.must_equal 'Ada'
#
# driver.must_respond_to :id
# driver.id.must_equal 108
#
# driver.must_respond_to :vin
# driver.vin.must_equal '123456789abcdefeg'
# end
#
# it "raises an error if the VIN is not 17 characters long" do
# invalid_vin = '123456dfsd'
#
# proc {
# RideShare::Driver.new(name: 'Ada', id: 108, vin: invalid_vin)
# }.must_raise ArgumentError
# end
#
# it "raises an error if the VIN has a character other than a letter or number" do
# invalid_vin = '12345!!12345ddegd'
#
# proc {
# RideShare::Driver.new(name: 'Ada', id: 108, vin: invalid_vin)
# }
# end
# end

describe "constructor" do

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good organization - the nested describes make this code much easier to read.

before do
@name = 'Ada'
@@ -77,4 +42,68 @@
}.must_raise RideShare::InvalidVinError
end
end

describe "trips" do
it "returns an array" do
skip
end

it "returns an array with only Trip objects" do

end

it "returns Trips that only THIS driver has taken" do

end
end

describe "avg_rating" do
it "returns a float to 1 decimal point" do

end

it "returns the overall avg_rating for a driver" do
#test decimal point
end
end

describe "Driver.all" do
# need to isolate opening CSV in own method/class variable?
# rescue CSV?

it "returns an array" do

end

it "returns an array with only Driver elements" do

end

it "returns all drivers in the CSV file" do
# [d1,d2,d3,d4].length = x
# &/or [d1, d2, d3] = expected_array
end
end

describe "Driver.find" do
# return nil or raise error if search isnt found?

# def find_and_verify private method

it "returns an account that exists" do

end

it "can find the first Driver from the CSV file" do

end

it "can find the last Driver from the CSV file" do

end

it "returns nil if driver_id is not found" do
# or raises an error
end
end
end