aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert2017-05-05 06:10:06 +0200
committerRobert2017-05-05 16:54:56 +0200
commit5d5707ad0d9711f369eff7ccef60d24b0247227b (patch)
tree4571034e9b54183650df79ac0ec689bf6e328afd
parent407885e41987c0c64913194396c5667483416192 (diff)
downloadchouette-core-5d5707ad0d9711f369eff7ccef60d24b0247227b.tar.bz2
Refs: #3297
- fix of RouteObserver#after_destroy (dead code right now, but see below) - change specs to use Route#destroy in order to trigger `dependent: :destroy' in stop_points (#delete does not work as stop_points is used in `has_many :stop_areas, through:', no doc found on this behavior, but #destroy is the advocated method to be used)
-rw-r--r--spec/models/chouette/route/route_delete_spec.rb12
1 files changed, 6 insertions, 6 deletions
diff --git a/spec/models/chouette/route/route_delete_spec.rb b/spec/models/chouette/route/route_delete_spec.rb
index fa8a8a947..ccc14d8bb 100644
--- a/spec/models/chouette/route/route_delete_spec.rb
+++ b/spec/models/chouette/route/route_delete_spec.rb
@@ -9,23 +9,23 @@ RSpec.describe Chouette::Route, :type => :model do
it "deletes the associated journey_patterns" do
expected_delta = subject.journey_patterns.count
expect( expected_delta ).to be_positive
- expect{ subject.delete }.to change{Chouette::JourneyPattern.count}.by -expected_delta
+ expect{ subject.destroy }.to change{Chouette::JourneyPattern.count}.by -expected_delta
end
it "deletes the associated stop_points" do
expected_delta = subject.stop_points.count
expect( expected_delta ).to be_positive
- expect{ subject.delete }.to change{Chouette::StopPoint.count}.by -expected_delta
+ expect{ subject.destroy }.to change{Chouette::StopPoint.count}.by -expected_delta
end
it "does not delete the associated stop_areas" do
count = subject.stop_points.count
expect( count ).to be_positive
- expect{ subject.delete }.not_to change{Chouette::StopArea.count}
+ expect{ subject.destroy }.not_to change{Chouette::StopArea.count}
end
it "deletes the associated vehicle_journeys" do
- expect{ vehicle_journey.route.delete }.to change{Chouette::VehicleJourney.count}.by -1
+ expect{ vehicle_journey.route.destroy}.to change{Chouette::VehicleJourney.count}.by -1
end
it "does not delete the corresponding time_tables" do
@@ -33,12 +33,12 @@ RSpec.describe Chouette::Route, :type => :model do
tt.vehicle_journeys << vehicle_journey
tables = vehicle_journey.route.time_tables
expect( tables ).not_to be_empty
- expect{ vehicle_journey.route.delete }.not_to change{Chouette::TimeTable.count}
+ expect{ vehicle_journey.route.destroy }.not_to change{Chouette::TimeTable.count}
end
it "does not delete the associated line" do
expect( subject.line ).not_to be_nil
- expect{ subject.delete }.not_to change{Chouette::Line.count}
+ expect{ subject.destroy }.not_to change{Chouette::Line.count}
end
end
end