diff options
| author | Alban Peignier | 2018-05-17 10:14:36 +0200 | 
|---|---|---|
| committer | Alban Peignier | 2018-05-17 10:14:36 +0200 | 
| commit | d1963bdd52c1d0fdc23606cd21e79b1f4fc9dc82 (patch) | |
| tree | ff2b23e2acaad1eb5847f0139b2a6e22dc98b396 /spec/services | |
| parent | 70d55a1a62a2207453b738cb81003f57c537473c (diff) | |
| download | chouette-core-d1963bdd52c1d0fdc23606cd21e79b1f4fc9dc82.tar.bz2 | |
Update RouteWayCostCalculator spec. Refs #6884
Diffstat (limited to 'spec/services')
| -rw-r--r-- | spec/services/route_way_cost_calculator_spec.rb | 10 | 
1 files changed, 6 insertions, 4 deletions
| diff --git a/spec/services/route_way_cost_calculator_spec.rb b/spec/services/route_way_cost_calculator_spec.rb index c417f137a..7b9c36596 100644 --- a/spec/services/route_way_cost_calculator_spec.rb +++ b/spec/services/route_way_cost_calculator_spec.rb @@ -1,10 +1,12 @@  RSpec.describe RouteWayCostCalculator do    describe "#calculate!" do +    before do +      allow(TomTom).to receive(:api_key).and_return('dummy') +    end +      it "calculates and stores WayCosts in the given route's #cost field" do        route = create(:route) -      allow(TomTom).to receive(:api_key).and_return('dummy') -        # Fake the request to the TomTom API, but don't actually send the right        # things in the request or response. This is just to fake the request so        # we don't actually call their API in tests. The test doesn't test @@ -37,14 +39,14 @@ RSpec.describe RouteWayCostCalculator do        stub_request(          :post, -        "https://api.tomtom.com/routing/1/matrix/json?key&routeType=shortest&travelMode=bus" +        "https://api.tomtom.com/routing/1/matrix/json?key=dummy&routeType=shortest&traffic=false&travelMode=bus"        )          .with(            headers: {              'Accept'=>'*/*',              'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',              'Content-Type'=>'application/json', -            'User-Agent'=>'Faraday v0.9.2' +            'User-Agent'=>'Faraday v0.15.1'            })          .to_return(            status: 200, | 
