aboutsummaryrefslogtreecommitdiffstats
path: root/spec
AgeCommit message (Collapse)Author
2018-05-29Refs #6860 Remove all call of referential_stop_areas_path & ↵cedricnjanga
referential_stop_area_path
2018-05-29Fix StopPoint#stop_area_lightZog
2018-05-28Merge pull request #569 from af83/6622-fix-loops-in-mergeLuc Donnet
6622 Ensure that the merge operation deals with loops well
2018-05-28Refs #6433; Fix specsZog
2018-05-28Refs #6433 Add changes to stop areas status filtercedricnjanga
2018-05-23Refs #5670 Fix I18n on user registration viewscedricnjanga
2018-05-17Test opposite routes in merge referential. Refs #6842Alban Peignier
2018-05-17Associate opposite_routes during merge (when available). Refs #6842Alban Peignier
2018-05-17Refs #6624; Update parent's checksum on deletionZog
2018-05-17Merge pull request #571 from ↵Alban Peignier
af83/6854-clean-up--destroy-routes-outside-referential Clean up destroy routes outside referential. Fixes #6854
2018-05-17Update RouteWayCostCalculator spec. Refs #6884Alban Peignier
2018-05-16Update RouteWayCostCalculator spec after Faraday. Refs #7032Alban Peignier
2018-05-16Merge pull request #553 from ↵Alban Peignier
af83/6884-tomtom-matrix--handle-error-when-response-doesn,t-inclu Handle API error(s) in Tomtom matrix. Fixes #6884
2018-05-15CleanUp: Add `#destroy_empty`6854-clean-up--destroy-routes-outside-referentialTeddy Wing
Gives us a single call site to trigger the destruction of vehicle journeys, journey patterns, and routes without content. This was previously done directly in the `#clean` method, but since it's not needed during referential duplication (only during merges), we don't want to enable it by default. Thus now to activate the same old functionality, you would create a `CleanUp` like this: CleanUp.new(methods: [:destroy_empty]) Refs #6854
2018-05-14CleanUp: Add `#run_methods`Teddy Wing
This method is coupled with a new virtual attribute that can be used in the initializer like: CleanUp.new(methods: [:destroy_routes]) The method will run all methods specified in the `:methods` list. The plan is to replace the calls to `destroy_routes` etc. with a call to this method. The result will be a more configurable clean-up process, allowing users to selectively choose what to clean up by declaring what methods in the `CleanUp` model to call. Refs #6854
2018-05-14CleanUp spec: Pass ids to `#exists?` callTeddy Wing
Looks like I temporarily forgot that this method takes an ID. Refs #6854
2018-05-14Refs #6622; Ensure that the merge operation deals with loops well6622-fix-loops-in-mergeZog
2018-05-14CleanUp#destroy_routes_outside_referential: Test cascadeTeddy Wing
Ensure that `JourneyPattern`s and `VehicleJourney`s associated with orphaned routes get deleted in cascade. Refs #6854
2018-05-14CleanUp: Add `#destroy_routes_outside_referential`Teddy Wing
This builds on `#destroy_vehicle_journeys_outside_referential` (which will soon be removed in favour of this new method). It destroys orphaned routes in a referential. Refs #6854
2018-05-14Refs #6998: Fix JS specs6998-fix-jest-specsZog
2018-05-13Disable Import::Netex API v1 request specs. Refs #6995Alban Peignier
2018-05-13Test api_key format in TomTom.enabled?. Refs #6993Alban Peignier
2018-05-13Define a dummy TomTom api_key in specAlban Peignier
2018-05-11Avoid time shift in User specsAlban Peignier
2018-05-11Refs #6647; Fix specsZog
2018-05-10Test WorkbenchesController without workbenches.update permission. Refs #69606960-workgroup-editionAlban Peignier
2018-05-10Fix specs. Refs #6960Alban Peignier
2018-05-09Fixes WorkbenchesController and WorkgroupsController specs. Refs #6960Alban Peignier
2018-05-09Refs #6961; Update Workbench#editZog
- Update the form - Use policies and update the seeds accordingly - Add a link in the navbar(s)
2018-05-07Refs #6960; Add a view to set the controls associated to each workbenchZog
2018-05-07Refs #6960; Add owners to workgroupsZog
And define policies
2018-05-04Move `TomTom::Matrix::RemoteError` to`TomTom::Errors::MatrixRemoteError`6884-tomtom-matrix--handle-error-when-response-doesn,t-incluTeddy Wing
I previously tried to correct a circular dependency problem in a057276129b1f62b811743db3b8f867a05241ed3, but that didn't fix it (it was intermittent, and came back). After some wrangling, I've now deduced with some confidence that the problem comes from `RouteWayCostCalculator`, which used `TomTom::Matrix::RemoteError`. From the way it looks, this seems to mess up the Rails autoloader since `tom_tom.rb` will try to load the `Matrix` class from the `TomTom.matrix` call above. Or something. In an attempt to fix the circular dependency error for real this time, move the error class to a completely separate module from `Matrix`, and refer to this when we need to use the error class. Refs #6884
2018-05-04Fixes RouteWayCostCalculator spec. Refs #6661Alban Peignier
2018-05-04Refs #6920; Fix specs6920-activate-newly-created-referentialsZog
2018-05-03TomTom::Matrix#check_for_error_response: Handle HTTP error status codesTeddy Wing
We might not always get a nicely formatted JSON `['error']['description']` response body. Sometimes, like for example when you use an incorrect API key, even with an 'application/json' content type, TomTom will respond with: <h1>Developer Inactive</h1> What? In that case, the response has a 403 status. In addition to checking for an error in the response, should also be checking for the HTTP status code. Log the status code in the exception to give us more information about what went wrong. Update our existing tests now that `#check_for_error_response` takes a response object instead of a JSON string. Refs #6884
2018-05-03TomTom::Matrix spec: Fix typo 'an' -> 'a'Teddy Wing
Refs #6884
2018-05-03Refs #6920; Fix typoZog
2018-05-03Refs #6921; Show "Unarchive" action in referentials listZog
2018-05-02RouteWayCostCalculator: Don't update `costs` if response errorsTeddy Wing
If there's an API error, we shouldn't update the route's `costs` field. Let's say we've already calculated some costs for a route A. We then edit and re-save A, which triggers a recalculation of the costs. Now the TomTom API responds with an error. We don't want to overwrite our existing costs with an empty array because they could still be useful. In this case, we should instead keep the existing costs we already had. To achieve this, move the `RemoteError` rescue into `RouteWayCostCalculator`, leaving the error unhandled in `TomTom.matrix`. Refs #6884
2018-05-02TomTom::Matrix: Handle error responses from TomTomTeddy Wing
Occasionally, the following error would appear in our logs: NoMethodError RouteWayCostWorker/perform Error message NoMethodError: undefined method `each_with_index' for nil:NilClass Stack trace (show Rails) /app/lib/tom_tom/matrix.rb: 83:in `extract_costs_to_way_costs!' /app/lib/tom_tom/matrix.rb: 23:in `matrix' /app/lib/tom_tom.rb: 24:in `matrix' /app/app/services/route_way_cost_calculator.rb: 8:in `calculate!' /app/app/workers/route_way_cost_worker.rb: 12:in `perform' …ems/2.3.0/gems/sidekiq-4.2.10/lib/sidekiq/processor.rb: 167:in `execute_job' …ems/2.3.0/gems/sidekiq-4.2.10/lib/sidekiq/processor.rb: 139:in `block (5 levels) in process' /var/lib/gems/2.3.0/gems/sidekiq-4.2.10/lib/sidekiq.rb: 36:in `block in <module:Sidekiq>' …ems/2.3.0/gems/sidekiq-4.2.10/lib/sidekiq/processor.rb: 135:in `block (4 levels) in process' ….0/gems/sidekiq-4.2.10/lib/sidekiq/middleware/chain.rb: 128:in `block in invoke' ….0/gems/sidekiq-4.2.10/lib/sidekiq/middleware/chain.rb: 130:in `block in invoke' …-4.2.10/lib/sidekiq/middleware/server/active_record.rb: 6:in `call' ….0/gems/sidekiq-4.2.10/lib/sidekiq/middleware/chain.rb: 130:in `block in invoke' …idekiq-4.2.10/lib/sidekiq/middleware/server/logging.rb: 10:in `call' ….0/gems/sidekiq-4.2.10/lib/sidekiq/middleware/chain.rb: 130:in `block in invoke' …kiq-4.2.10/lib/sidekiq/middleware/server/retry_jobs.rb: 74:in `call' ….0/gems/sidekiq-4.2.10/lib/sidekiq/middleware/chain.rb: 130:in `block in invoke' ….0/gems/sidekiq-4.2.10/lib/sidekiq/middleware/chain.rb: 133:in `invoke' …ems/2.3.0/gems/sidekiq-4.2.10/lib/sidekiq/processor.rb: 134:in `block (3 levels) in process' …/gems/2.3.0/gems/sidekiq-4.2.10/lib/sidekiq/logging.rb: 32:in `with_context' …ems/2.3.0/gems/sidekiq-4.2.10/lib/sidekiq/processor.rb: 132:in `block (2 levels) in process' …ems/2.3.0/gems/sidekiq-4.2.10/lib/sidekiq/processor.rb: 183:in `stats' …ems/2.3.0/gems/sidekiq-4.2.10/lib/sidekiq/processor.rb: 131:in `block in process' /var/lib/gems/2.3.0/gems/sidekiq-4.2.10/lib/sidekiq.rb: 35:in `block in <module:Sidekiq>' …ems/2.3.0/gems/sidekiq-4.2.10/lib/sidekiq/processor.rb: 126:in `process' …ems/2.3.0/gems/sidekiq-4.2.10/lib/sidekiq/processor.rb: 82:in `process_one' …ems/2.3.0/gems/sidekiq-4.2.10/lib/sidekiq/processor.rb: 70:in `run' …lib/gems/2.3.0/gems/sidekiq-4.2.10/lib/sidekiq/util.rb: 17:in `watchdog' …lib/gems/2.3.0/gems/sidekiq-4.2.10/lib/sidekiq/util.rb: 26:in `block in safe_thread' My best guess is that this was caused by TomTom responding with an error, which we weren't handling previously. In that case, the response would be a JSON string, but include an `'error'` field instead of `'matrix'` and `'summary'`. Thus, when we'd try to `matrix_json['matrix']`, it would fail. Add a new method that checks for errors before we try to parse `WayCost`s. If a server error is detected, we log the message to the Rails log and return an empty array. Refs #6884
2018-05-02Merge pull request #546 from af83/6572-make-new-referentials-pendingLuc Donnet
6572 Create Referentials in a pending state
2018-05-02Refs #6572; Fix specs6572-make-new-referentials-pendingZog
2018-05-02Refs #6572; Crete Referentials in a pending stateZog
And fix a bug preventing the deletion of referentials without a schema
2018-04-30Workbenches#show: Don't allow pending referentials to be selected6858-workbenches-show--disallow-deletion-of-pending-referentTeddy Wing
Disable the checkboxes next to pending referentials. This prevents them from being deleted by the batch deletion operation. In general it seems like we shouldn't be operating on pending referentials, so if any new batch actions are added, it would make sense to me for the checkboxes to stay disabled. We want to disallow deletion of pending referentials because this can put the data in an inconsistent state that requires manual intervention to clean (I think). Refs #6858
2018-04-30Fix VehicleJourney#fill_passing_times!Zog
2018-04-29Fix more specsZog
2018-04-29Fix specsZog
2018-04-27:fire: logZog
2018-04-27Refs #6572; Fix specsZog
2018-04-27Refs #6572; Fix specsZog