diff options
| author | Zog | 2018-05-30 15:44:14 +0200 |
|---|---|---|
| committer | Zog | 2018-05-30 15:44:14 +0200 |
| commit | dbae7bc51423fc5d8b9f08fdd31a38705c5cf771 (patch) | |
| tree | 12fb5b7d292154ce9ff7a4781476a603e5e16012 | |
| parent | 819b03075f74018b8f16a2f73fa7a526f704a675 (diff) | |
| download | chouette-core-dbae7bc51423fc5d8b9f08fdd31a38705c5cf771.tar.bz2 | |
Refs #7227; Fix deletion of routes hving oppositescustom-clean-on-routes
| -rw-r--r-- | app/models/chouette/route.rb | 1 | ||||
| -rw-r--r-- | spec/models/clean_up_spec.rb | 5 |
2 files changed, 4 insertions, 2 deletions
diff --git a/app/models/chouette/route.rb b/app/models/chouette/route.rb index f1cc562f1..00e5d27fa 100644 --- a/app/models/chouette/route.rb +++ b/app/models/chouette/route.rb @@ -101,6 +101,7 @@ module Chouette journey_patterns.delete_all stop_points.delete_all routing_constraint_zones.delete_all + Chouette::Route.where(opposite_route_id: self.id).update_all(opposite_route_id: nil) self.delete end diff --git a/spec/models/clean_up_spec.rb b/spec/models/clean_up_spec.rb index f39ca2f2b..5848c1f77 100644 --- a/spec/models/clean_up_spec.rb +++ b/spec/models/clean_up_spec.rb @@ -273,8 +273,9 @@ RSpec.describe CleanUp, :type => :model do let(:cleaner) { create(:clean_up, referential: referential) } it "destroys routes not in the the referential" do - route = create(:route) - + route = create :route + opposite = create :route, line: route.line, opposite_route: route, wayback: route.opposite_wayback + cleaner.destroy_routes_outside_referential expect(Chouette::Route.exists?(route.id)).to be false |
