diff options
| author | Teddy Wing | 2018-05-14 12:58:56 +0200 | 
|---|---|---|
| committer | Teddy Wing | 2018-05-14 12:58:56 +0200 | 
| commit | c048a5a7e5295b7a84d87ed4e850affe598d5588 (patch) | |
| tree | ca443c1af873f1573241a339990b485f130294fb | |
| parent | 84683c111e16e19c94a71f36f1d66c0745ad33d8 (diff) | |
| download | chouette-core-c048a5a7e5295b7a84d87ed4e850affe598d5588.tar.bz2 | |
CleanUp#destroy_routes_outside_referential: Test cascade
Ensure that `JourneyPattern`s and `VehicleJourney`s associated with
orphaned routes get deleted in cascade.
Refs #6854
| -rw-r--r-- | spec/models/clean_up_spec.rb | 12 | 
1 files changed, 12 insertions, 0 deletions
| diff --git a/spec/models/clean_up_spec.rb b/spec/models/clean_up_spec.rb index cf15ab934..be169abbb 100644 --- a/spec/models/clean_up_spec.rb +++ b/spec/models/clean_up_spec.rb @@ -283,5 +283,17 @@ RSpec.describe CleanUp, :type => :model do          expect(route).not_to be_destroyed        end      end + +    it "cascades destruction of vehicle journeys and journey patterns" do +      vehicle_journey = create(:vehicle_journey) + +      cleaner.destroy_routes_outside_referential + +      expect(Chouette::Route.exists?(vehicle_journey.route.id)).to be false +      expect( +        Chouette::JourneyPattern.exists?(vehicle_journey.journey_pattern) +      ).to be false +      expect(Chouette::VehicleJourney.exists?(vehicle_journey)).to be false +    end    end  end | 
