-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgoogle_maps_api_spec.rb
More file actions
31 lines (27 loc) · 1.21 KB
/
google_maps_api_spec.rb
File metadata and controls
31 lines (27 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
require './google_maps_api.rb'
require './drive_route'
describe 'Route' do
before :each do
@driving_route = DriveRoute.new("923 Market St., San Francisco, CA", "1703 Telegraph Avenue, Oakland, CA")
# GasPrice = double("GasPrice")
# # GasPrice.stub!(:find_gas_price).and_return(4.0)
# GasPrice.stub(:find_gas_price).and_return(4.0)
gas_stub = double("GasPrice")
GasPrice.stub(:find_gas_price) {gas_stub}
gas_stub.stub(:find_gas_price) {4.0}
end
it "when passed a driving route, returns a route object" do
@driving_route.should be_an_instance_of DriveRoute
@driving_route.origin.should be_an_instance_of String
@driving_route.destination.should be_an_instance_of String
@driving_route.cost_in_pennies.should be_an_instance_of Fixnum
@driving_route.time_in_seconds.should be_an_instance_of Fixnum
end
it "returns proper input for a test drive route" do
@driving_route.origin.should == "923 Market St., San Francisco, CA"
@driving_route.destination.should == "1703 Telegraph Avenue, Oakland, CA"
# puts GasPrice.find_gas_price(94108)
@driving_route.cost_in_pennies.should be_within(1).of(166)
@driving_route.time_in_seconds.should == 1140
end
end