diff options
| author | Zog | 2018-04-10 09:01:40 +0200 |
|---|---|---|
| committer | Zog | 2018-04-10 09:01:40 +0200 |
| commit | 61dfb9c7489cc7d26d2fd9830d02be5c633b8b21 (patch) | |
| tree | 00657b029d650d52e93e2d6a1ca0a943f1629a0b | |
| parent | 98c723ee956b478e8ffb466e461c9889a272efdf (diff) | |
| download | chouette-core-61dfb9c7489cc7d26d2fd9830d02be5c633b8b21.tar.bz2 | |
Refs #6481; Add a spec to ensure we d'ont alter the original route when duplicating it6481-inverted-stops
| -rw-r--r-- | spec/controllers/routes_controller_spec.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/spec/controllers/routes_controller_spec.rb b/spec/controllers/routes_controller_spec.rb index a001a942d..9ab3544b4 100644 --- a/spec/controllers/routes_controller_spec.rb +++ b/spec/controllers/routes_controller_spec.rb @@ -87,6 +87,9 @@ RSpec.describe RoutesController, type: :controller do end context "when opposite = true" do + before do + @positions = Hash[*route.stop_points.map{|sp| [sp.id, sp.position]}.flatten] + end it "creates a new route on the opposite way " do expect do post :duplicate, @@ -100,6 +103,9 @@ RSpec.describe RoutesController, type: :controller do expect(Chouette::Route.last.published_name).to eq(Chouette::Route.last.name) expect(Chouette::Route.last.opposite_route).to eq(route) expect(Chouette::Route.last.stop_area_ids).to eq route.stop_area_ids.reverse + route.reload.stop_points.each do |sp| + expect(sp.position).to eq @positions[sp.id] + end end end |
