diff options
| author | Xinhui | 2017-07-25 17:26:16 +0200 |
|---|---|---|
| committer | Xinhui | 2017-07-25 17:26:16 +0200 |
| commit | cf874823dada5882439c16b5290a6e72ef7712cf (patch) | |
| tree | 42711cecefb0db576d43a6eec65b5c909df1bc50 | |
| parent | 29ee74e00700f95cadbf1d462dddaad1167ffd82 (diff) | |
| download | chouette-core-cf874823dada5882439c16b5290a6e72ef7712cf.tar.bz2 | |
Edit factories objectid in accordance with new stif netex format
| -rw-r--r-- | spec/factories/chouette_access_links.rb | 6 | ||||
| -rw-r--r-- | spec/factories/chouette_access_points.rb | 2 | ||||
| -rw-r--r-- | spec/factories/chouette_companies.rb | 2 | ||||
| -rw-r--r-- | spec/factories/chouette_connection_links.rb | 4 | ||||
| -rw-r--r-- | spec/factories/chouette_journey_pattern.rb | 12 | ||||
| -rw-r--r-- | spec/factories/chouette_networks.rb | 2 | ||||
| -rw-r--r-- | spec/factories/chouette_routes.rb | 2 | ||||
| -rw-r--r-- | spec/factories/chouette_stop_points.rb | 2 | ||||
| -rw-r--r-- | spec/factories/chouette_time_table.rb | 2 | ||||
| -rw-r--r-- | spec/factories/chouette_timeband.rb | 4 | ||||
| -rw-r--r-- | spec/factories/chouette_vehicle_journey.rb | 2 | ||||
| -rw-r--r-- | spec/models/chouette/access_link_spec.rb | 12 | ||||
| -rw-r--r-- | spec/models/chouette/access_point_spec.rb | 2 | ||||
| -rw-r--r-- | spec/models/chouette/connection_link_spec.rb | 2 | ||||
| -rw-r--r-- | spec/models/chouette/route/route_base_spec.rb | 2 | ||||
| -rw-r--r-- | spec/models/chouette/stop_point_spec.rb | 2 | ||||
| -rw-r--r-- | spec/models/chouette/time_table_spec.rb | 22 |
17 files changed, 41 insertions, 41 deletions
diff --git a/spec/factories/chouette_access_links.rb b/spec/factories/chouette_access_links.rb index 94717e95e..8b4e89be9 100644 --- a/spec/factories/chouette_access_links.rb +++ b/spec/factories/chouette_access_links.rb @@ -1,9 +1,9 @@ FactoryGirl.define do - + factory :access_link, :class => Chouette::AccessLink do sequence(:name) { |n| "Access link #{n}" } - sequence(:objectid) { |n| "test:AccessLink:#{n}" } - link_type "Mixed" + sequence(:objectid) { |n| "test:AccessLink:#{n}:loc" } + link_type "Mixed" link_orientation "AccessPointToStopArea" association :stop_area, :factory => :stop_area diff --git a/spec/factories/chouette_access_points.rb b/spec/factories/chouette_access_points.rb index 06d1da779..213323f56 100644 --- a/spec/factories/chouette_access_points.rb +++ b/spec/factories/chouette_access_points.rb @@ -5,7 +5,7 @@ FactoryGirl.define do longitude {10.0 * rand} sequence(:name) { |n| "AccessPoint #{n}" } access_type "InOut" - sequence(:objectid) { |n| "test:AccessPoint:#{n}" } + sequence(:objectid) { |n| "test:AccessPoint:#{n}:loc" } association :stop_area, :factory => :stop_area end diff --git a/spec/factories/chouette_companies.rb b/spec/factories/chouette_companies.rb index 35ce34257..ecd3dcfc2 100644 --- a/spec/factories/chouette_companies.rb +++ b/spec/factories/chouette_companies.rb @@ -2,7 +2,7 @@ FactoryGirl.define do factory :company, :class => Chouette::Company do sequence(:name) { |n| "Company #{n}" } - sequence(:objectid) { |n| "chouette:test:Company:#{n}" } + sequence(:objectid) { |n| "chouette:Company:#{n}:loc" } sequence(:registration_number) { |n| "test-#{n}" } association :line_referential, :factory => :line_referential diff --git a/spec/factories/chouette_connection_links.rb b/spec/factories/chouette_connection_links.rb index f70548721..9185480ac 100644 --- a/spec/factories/chouette_connection_links.rb +++ b/spec/factories/chouette_connection_links.rb @@ -3,11 +3,11 @@ FactoryGirl.define do factory :connection_link, :class => Chouette::ConnectionLink do sequence(:name) { |n| "Connection link #{n}" } sequence(:link_type) { |n| "Mixed" } - sequence(:objectid) { |n| "test:ConnectionLink:#{n}" } + sequence(:objectid) { |n| "test:ConnectionLink:#{n}:loc" } association :departure, :factory => :stop_area association :arrival, :factory => :stop_area end - + end diff --git a/spec/factories/chouette_journey_pattern.rb b/spec/factories/chouette_journey_pattern.rb index bf55b286f..50ff10a77 100644 --- a/spec/factories/chouette_journey_pattern.rb +++ b/spec/factories/chouette_journey_pattern.rb @@ -1,14 +1,14 @@ FactoryGirl.define do - + factory :journey_pattern_common, :class => Chouette::JourneyPattern do sequence(:name) { |n| "jp name #{n}" } sequence(:published_name) { |n| "jp publishedname #{n}" } sequence(:comment) { |n| "jp comment #{n}" } sequence(:registration_number) { |n| "jp registration_number #{n}" } - sequence(:objectid) { |n| "test:JourneyPattern:#{n}" } - + sequence(:objectid) { |n| "test:JourneyPattern:#{n}:loc" } + association :route, :factory => :route - + factory :journey_pattern do after(:create) do |j| j.stop_point_ids = j.route.stop_points.map(&:id) @@ -16,7 +16,7 @@ FactoryGirl.define do j.arrival_stop_point_id = j.route.stop_points.last.id end end - + factory :journey_pattern_odd do after(:create) do |j| j.stop_point_ids = j.route.stop_points.select { |sp| sp.position%2==0}.map(&:id) @@ -24,7 +24,7 @@ FactoryGirl.define do j.arrival_stop_point_id = j.stop_point_ids.last end end - + factory :journey_pattern_even do after(:create) do |j| j.stop_point_ids = j.route.stop_points.select { |sp| sp.position%2==1}.map(&:id) diff --git a/spec/factories/chouette_networks.rb b/spec/factories/chouette_networks.rb index 3ad719cd9..d127b1125 100644 --- a/spec/factories/chouette_networks.rb +++ b/spec/factories/chouette_networks.rb @@ -2,7 +2,7 @@ FactoryGirl.define do factory :network, :class => Chouette::Network do sequence(:name) { |n| "Network #{n}" } - sequence(:objectid) { |n| "chouette:test:GroupOfLine:#{n}" } + sequence(:objectid) { |n| "chouette:GroupOfLine:#{n}:loc" } sequence(:registration_number) { |n| "test-#{n}" } association :line_referential diff --git a/spec/factories/chouette_routes.rb b/spec/factories/chouette_routes.rb index c1a9423c5..50c9ad230 100644 --- a/spec/factories/chouette_routes.rb +++ b/spec/factories/chouette_routes.rb @@ -6,7 +6,7 @@ FactoryGirl.define do sequence(:number) { |n| "#{n}" } sequence(:wayback) { |n| Chouette::Route.wayback.values[n % 2] } sequence(:direction) { |n| Chouette::Route.direction.values[n % 12] } - sequence(:objectid) { |n| "test:Route:#{n}" } + sequence(:objectid) { |n| "test:Route:#{n}:loc" } association :line, :factory => :line diff --git a/spec/factories/chouette_stop_points.rb b/spec/factories/chouette_stop_points.rb index 690d1c688..14e08b1ac 100644 --- a/spec/factories/chouette_stop_points.rb +++ b/spec/factories/chouette_stop_points.rb @@ -1,7 +1,7 @@ FactoryGirl.define do factory :stop_point, :class => Chouette::StopPoint do - sequence(:objectid) { |n| "test:StopPoint:#{n}" } + sequence(:objectid) { |n| "test:StopPoint:#{n}:loc" } association :stop_area, :factory => :stop_area end diff --git a/spec/factories/chouette_time_table.rb b/spec/factories/chouette_time_table.rb index 6480df79d..3df0305f0 100644 --- a/spec/factories/chouette_time_table.rb +++ b/spec/factories/chouette_time_table.rb @@ -9,7 +9,7 @@ FactoryGirl.define do factory :time_table, :class => Chouette::TimeTable do sequence(:comment) { |n| "Timetable #{n}" } - sequence(:objectid) { |n| "test:Timetable:#{n}" } + sequence(:objectid) { |n| "test:Timetable:#{n}:loc" } sequence(:int_day_types) { (1..7).to_a.map{ |n| 2**(n+1)}.sum } calendar nil diff --git a/spec/factories/chouette_timeband.rb b/spec/factories/chouette_timeband.rb index 6e2825c22..010461479 100644 --- a/spec/factories/chouette_timeband.rb +++ b/spec/factories/chouette_timeband.rb @@ -4,14 +4,14 @@ FactoryGirl.define do sequence(:name) { |n| "Name: #{n}" } start_time { Time.now } end_time { Time.now + 1.hour } - sequence(:objectid) { |n| "test:Timeband:#{n}" } + sequence(:objectid) { |n| "test:Timeband:#{n}:loc" } end factory :timeband_invalid, class: Chouette::Timeband do sequence(:name) { |n| "Name: #{n}" } start_time { Time.now + 1.hour } end_time { Time.now } - sequence(:objectid) { |n| "test:Timeband:#{n}" } + sequence(:objectid) { |n| "test:Timeband:#{n}:loc" } end end diff --git a/spec/factories/chouette_vehicle_journey.rb b/spec/factories/chouette_vehicle_journey.rb index e7ecb79ac..a95b462bf 100644 --- a/spec/factories/chouette_vehicle_journey.rb +++ b/spec/factories/chouette_vehicle_journey.rb @@ -1,7 +1,7 @@ FactoryGirl.define do factory :vehicle_journey_common, :class => Chouette::VehicleJourney do - sequence(:objectid) { |n| "test:VehicleJourney:#{n}" } + sequence(:objectid) { |n| "test:VehicleJourney:#{n}:loc" } factory :vehicle_journey_empty do association :journey_pattern, :factory => :journey_pattern diff --git a/spec/models/chouette/access_link_spec.rb b/spec/models/chouette/access_link_spec.rb index 0e1e91593..5a31b8f0c 100644 --- a/spec/models/chouette/access_link_spec.rb +++ b/spec/models/chouette/access_link_spec.rb @@ -7,7 +7,7 @@ describe Chouette::AccessLink, :type => :model do describe '#objectid' do subject { super().objectid } - it { is_expected.to be_kind_of(Chouette::ObjectId) } + it { is_expected.to be_kind_of(Chouette::StifNetexObjectid) } end it { is_expected.to validate_presence_of :name } @@ -19,7 +19,7 @@ describe Chouette::AccessLink, :type => :model do def self.legacy_link_types %w{Underground Mixed Overground} end - + legacy_link_types.each do |link_type| context "when link_type is #{link_type}" do access_link_type = Chouette::ConnectionLinkType.new(link_type.underscore) @@ -32,7 +32,7 @@ describe Chouette::AccessLink, :type => :model do end describe "#access_link_type=" do - + it "should change link_type with ConnectionLinkType#name" do subject.access_link_type = "underground" expect(subject.link_type).to eq("Underground") @@ -45,7 +45,7 @@ describe Chouette::AccessLink, :type => :model do def self.legacy_link_orientations %w{AccessPointToStopArea StopAreaToAccessPoint} end - + legacy_link_orientations.each do |link_orientation| context "when link_orientation is #{link_orientation}" do link_orientation_type = Chouette::LinkOrientationType.new(link_orientation.underscore) @@ -59,7 +59,7 @@ describe Chouette::AccessLink, :type => :model do end describe "#link_orientation_type=" do - + it "should change link_orientation with LinkOrientationType#name" do subject.link_orientation_type = "access_point_to_stop_area" expect(subject.link_orientation).to eq("AccessPointToStopArea") @@ -76,7 +76,7 @@ describe Chouette::AccessLink, :type => :model do subject.link_orientation_type = "stop_area_to_access_point" expect(subject.link_key).to eq("S_#{subject.stop_area.id}-A_#{subject.access_point.id}") end - + end end diff --git a/spec/models/chouette/access_point_spec.rb b/spec/models/chouette/access_point_spec.rb index 02b1621e3..cc26d2aa8 100644 --- a/spec/models/chouette/access_point_spec.rb +++ b/spec/models/chouette/access_point_spec.rb @@ -4,7 +4,7 @@ describe Chouette::AccessPoint, :type => :model do describe '#objectid' do subject { super().objectid } - it { is_expected.to be_kind_of(Chouette::ObjectId) } + it { is_expected.to be_kind_of(Chouette::StifNetexObjectid) } end it { is_expected.to validate_presence_of :name } diff --git a/spec/models/chouette/connection_link_spec.rb b/spec/models/chouette/connection_link_spec.rb index 5921bf581..57eb7d66c 100644 --- a/spec/models/chouette/connection_link_spec.rb +++ b/spec/models/chouette/connection_link_spec.rb @@ -11,7 +11,7 @@ describe Chouette::ConnectionLink, :type => :model do describe '#objectid' do subject { super().objectid } - it { is_expected.to be_kind_of(Chouette::ObjectId) } + it { is_expected.to be_kind_of(Chouette::StifNetexObjectid) } end it { is_expected.to validate_presence_of :name } diff --git a/spec/models/chouette/route/route_base_spec.rb b/spec/models/chouette/route/route_base_spec.rb index 08f201022..4bf25c2bc 100644 --- a/spec/models/chouette/route/route_base_spec.rb +++ b/spec/models/chouette/route/route_base_spec.rb @@ -4,7 +4,7 @@ RSpec.describe Chouette::Route, :type => :model do describe '#objectid' do subject { super().objectid } - it { is_expected.to be_kind_of(Chouette::ObjectId) } + it { is_expected.to be_kind_of(Chouette::StifNetexObjectid) } end it { is_expected.to enumerize(:direction).in(:straight_forward, :backward, :clockwise, :counter_clockwise, :north, :north_west, :west, :south_west, :south, :south_east, :east, :north_east) } diff --git a/spec/models/chouette/stop_point_spec.rb b/spec/models/chouette/stop_point_spec.rb index 212c32e1a..5eae8caf0 100644 --- a/spec/models/chouette/stop_point_spec.rb +++ b/spec/models/chouette/stop_point_spec.rb @@ -9,7 +9,7 @@ describe Chouette::StopPoint, :type => :model do describe '#objectid' do subject { super().objectid } - it { is_expected.to be_kind_of(Chouette::ObjectId) } + it { is_expected.to be_kind_of(Chouette::StifNetexObjectid) } end describe "#destroy" do diff --git a/spec/models/chouette/time_table_spec.rb b/spec/models/chouette/time_table_spec.rb index fb59a75be..d7738bbf6 100644 --- a/spec/models/chouette/time_table_spec.rb +++ b/spec/models/chouette/time_table_spec.rb @@ -813,13 +813,13 @@ end describe "#intersects" do it "should return day if a date equal day" do - time_table = Chouette::TimeTable.create!(:comment => "Test", :objectid => "test:Timetable:1") + time_table = Chouette::TimeTable.create!(:comment => "Test", :objectid => "test:Timetable:1:loc") time_table.dates << Chouette::TimeTableDate.new( :date => Date.today, :in_out => true) expect(time_table.intersects([Date.today])).to eq([Date.today]) end it "should return [] if a period not include days" do - time_table = Chouette::TimeTable.create!(:comment => "Test", :objectid => "test:Timetable:1", :int_day_types => 12) + time_table = Chouette::TimeTable.create!(:comment => "Test", :objectid => "test:Timetable:1:loc", :int_day_types => 12) time_table.periods << Chouette::TimeTablePeriod.new( :period_start => Date.new(2013, 05, 27), :period_end => Date.new(2013, 05, 30)) @@ -827,7 +827,7 @@ end end it "should return days if a period include day" do - time_table = Chouette::TimeTable.create!(:comment => "Test", :objectid => "test:Timetable:1", :int_day_types => 12) # Day type monday and tuesday + time_table = Chouette::TimeTable.create!(:comment => "Test", :objectid => "test:Timetable:1:loc", :int_day_types => 12) # Day type monday and tuesday time_table.periods << Chouette::TimeTablePeriod.new( :period_start => Date.new(2013, 05, 27), :period_end => Date.new(2013, 05, 30)) @@ -839,13 +839,13 @@ end describe "#include_day?" do it "should return true if a date equal day" do - time_table = Chouette::TimeTable.create!(:comment => "Test", :objectid => "test:Timetable:1") + time_table = Chouette::TimeTable.create!(:comment => "Test", :objectid => "test:Timetable:1:loc") time_table.dates << Chouette::TimeTableDate.new( :date => Date.today, :in_out => true) expect(time_table.include_day?(Date.today)).to eq(true) end it "should return true if a period include day" do - time_table = Chouette::TimeTable.create!(:comment => "Test", :objectid => "test:Timetable:1", :int_day_types => 12) # Day type monday and tuesday + time_table = Chouette::TimeTable.create!(:comment => "Test", :objectid => "test:Timetable:1:loc", :int_day_types => 12) # Day type monday and tuesday time_table.periods << Chouette::TimeTablePeriod.new( :period_start => Date.new(2013, 05, 27), :period_end => Date.new(2013, 05, 29)) @@ -855,13 +855,13 @@ end describe "#include_in_dates?" do it "should return true if a date equal day" do - time_table = Chouette::TimeTable.create!(:comment => "Test", :objectid => "test:Timetable:1") + time_table = Chouette::TimeTable.create!(:comment => "Test", :objectid => "test:Timetable:1:loc") time_table.dates << Chouette::TimeTableDate.new( :date => Date.today, :in_out => true) expect(time_table.include_in_dates?(Date.today)).to eq(true) end it "should return false if a period include day but that is exclued" do - time_table = Chouette::TimeTable.create!(:comment => "Test", :objectid => "test:Timetable:1", :int_day_types => 12) # Day type monday and tuesday + time_table = Chouette::TimeTable.create!(:comment => "Test", :objectid => "test:Timetable:1:loc", :int_day_types => 12) # Day type monday and tuesday excluded_date = Date.new(2013, 05, 27) time_table.dates << Chouette::TimeTableDate.new( :date => excluded_date, :in_out => false) expect(time_table.include_in_dates?( excluded_date)).to be_falsey @@ -870,7 +870,7 @@ end describe "#include_in_periods?" do it "should return true if a period include day" do - time_table = Chouette::TimeTable.create!(:comment => "Test", :objectid => "test:Timetable:1", :int_day_types => 4) + time_table = Chouette::TimeTable.create!(:comment => "Test", :objectid => "test:Timetable:1:loc", :int_day_types => 4) time_table.periods << Chouette::TimeTablePeriod.new( :period_start => Date.new(2012, 1, 1), :period_end => Date.new(2012, 01, 30)) @@ -878,7 +878,7 @@ end end it "should return false if a period include day but that is exclued" do - time_table = Chouette::TimeTable.create!(:comment => "Test", :objectid => "test:Timetable:1", :int_day_types => 12) # Day type monday and tuesday + time_table = Chouette::TimeTable.create!(:comment => "Test", :objectid => "test:Timetable:1:loc", :int_day_types => 12) # Day type monday and tuesday excluded_date = Date.new(2013, 05, 27) time_table.dates << Chouette::TimeTableDate.new( :date => excluded_date, :in_out => false) time_table.periods << Chouette::TimeTablePeriod.new( @@ -890,7 +890,7 @@ end describe "#include_in_overlap_dates?" do it "should return true if a day is included in overlap dates" do - time_table = Chouette::TimeTable.create!(:comment => "Test", :objectid => "test:Timetable:1", :int_day_types => 4) + time_table = Chouette::TimeTable.create!(:comment => "Test", :objectid => "test:Timetable:1:loc", :int_day_types => 4) time_table.periods << Chouette::TimeTablePeriod.new( :period_start => Date.new(2012, 1, 1), :period_end => Date.new(2012, 01, 30)) @@ -898,7 +898,7 @@ end expect(time_table.include_in_overlap_dates?(Date.new(2012, 1, 2))).to eq(true) end it "should return false if the day is excluded" do - time_table = Chouette::TimeTable.create!(:comment => "Test", :objectid => "test:Timetable:1", :int_day_types => 4) + time_table = Chouette::TimeTable.create!(:comment => "Test", :objectid => "test:Timetable:1:loc", :int_day_types => 4) time_table.periods << Chouette::TimeTablePeriod.new( :period_start => Date.new(2012, 1, 1), :period_end => Date.new(2012, 01, 30)) |
