aboutsummaryrefslogtreecommitdiffstats
path: root/spec/models/clean_up_spec.rb
diff options
context:
space:
mode:
authorTeddy Wing2018-05-15 15:24:29 +0200
committerTeddy Wing2018-05-15 15:24:29 +0200
commitceec2e53425f8a1c726f4903d03e268386cb598e (patch)
treea77345d0389ba2f3cda8b4d6cb57b37bc99e0c36 /spec/models/clean_up_spec.rb
parent3667a7d4976a9e69ae990df9ba681f679e0ee4fa (diff)
downloadchouette-core-ceec2e53425f8a1c726f4903d03e268386cb598e.tar.bz2
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
Diffstat (limited to 'spec/models/clean_up_spec.rb')
-rw-r--r--spec/models/clean_up_spec.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/models/clean_up_spec.rb b/spec/models/clean_up_spec.rb
index f0c3a3233..f39ca2f2b 100644
--- a/spec/models/clean_up_spec.rb
+++ b/spec/models/clean_up_spec.rb
@@ -297,6 +297,18 @@ RSpec.describe CleanUp, :type => :model do
end
end
+ describe "#destroy_empty" do
+ it "calls the appropriate destroy methods" do
+ cleaner = create(:clean_up)
+
+ expect(cleaner).to receive(:destroy_vehicle_journeys)
+ expect(cleaner).to receive(:destroy_journey_patterns)
+ expect(cleaner).to receive(:destroy_routes)
+
+ cleaner.destroy_empty
+ end
+ end
+
describe "#run_methods" do
let(:cleaner) { create(:clean_up) }