diff options
| author | Robert | 2017-08-14 18:41:14 +0200 |
|---|---|---|
| committer | Robert | 2017-08-14 18:41:14 +0200 |
| commit | c16c03b91174cf637e0bd2f0e3336e3788f43e59 (patch) | |
| tree | 7fc68229e3c64e31445808bb20f39818a482246d | |
| parent | c7d7d1c43fb48eedd8a4574b737c426ca2b2c407 (diff) | |
| download | chouette-core-c16c03b91174cf637e0bd2f0e3336e3788f43e59.tar.bz2 | |
Refs: #4189@3h; Specing Chouette::Route#duplicate (no stubbed spec, alas)
| -rw-r--r-- | spec/models/chouette/route/route_duplication_spec.rb | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/spec/models/chouette/route/route_duplication_spec.rb b/spec/models/chouette/route/route_duplication_spec.rb new file mode 100644 index 000000000..fe8d5e444 --- /dev/null +++ b/spec/models/chouette/route/route_duplication_spec.rb @@ -0,0 +1,31 @@ +# From Chouette import what we need ™ +Route = Chouette::Route +StopArea = Chouette::StopArea +StopPoint = Chouette::StopPoint + +RSpec.describe Route do + + let( :route ){ create :route } + + context 'duplicates' do + describe 'a route' do + it 'by creating a new one' do + expect{ route.duplicate }.to change{Route.count}.by(1) + end + it 'with the same values' do + expect( values_for_create(Route.last) ).to eq( values_for_create( route ) ) + end + + it 'and also duplicating its stop points' do + expect{ route.dublicate }.to change{StopPoint.count}.by(route.stop_points.count) + end + it 'but leaving the stop areas alone' do + expect{ route.duplicate }.not_to change{StopArea.count} + end + it "which are still accessible by the new route though" do + expect( route.duplicate.stop_areas ).to eq(route.stop_areas) + end + end + end + +end |
