diff options
| author | Robert | 2017-09-11 18:03:06 +0200 |
|---|---|---|
| committer | Robert | 2017-09-11 18:03:06 +0200 |
| commit | 37865fad65adacae41bff0677651ca0a4d9db974 (patch) | |
| tree | 0889ea9d7883bb27b493c16b9b08426fa22545a0 /spec | |
| parent | f7bc874de79ff9a68aa03523cf653407663e7c55 (diff) | |
| parent | 8fe9a39516f6fb71545d6329c448680d6f8c75d1 (diff) | |
| download | chouette-core-37865fad65adacae41bff0677651ca0a4d9db974.tar.bz2 | |
merged with master
Diffstat (limited to 'spec')
89 files changed, 3150 insertions, 1084 deletions
diff --git a/spec/controllers/api/v1/iboo_controller_spec.rb b/spec/controllers/api/v1/iboo_controller_spec.rb new file mode 100644 index 000000000..64a929d1a --- /dev/null +++ b/spec/controllers/api/v1/iboo_controller_spec.rb @@ -0,0 +1,12 @@ +require 'rails_helper' + +RSpec.describe Api::V1::IbooController, type: :controller do + context '#authenticate' do + include_context 'iboo authenticated api user' + + it 'should set current organisation' do + controller.send(:authenticate) + expect(assigns(:current_organisation)).to eq api_key.organisation + end + end +end diff --git a/spec/controllers/api/v1/imports_controller_spec.rb b/spec/controllers/api/v1/imports_controller_spec.rb new file mode 100644 index 000000000..266b25486 --- /dev/null +++ b/spec/controllers/api/v1/imports_controller_spec.rb @@ -0,0 +1,38 @@ +require 'rails_helper' + +RSpec.describe Api::V1::ImportsController, type: :controller do + let(:workbench) { create :workbench, organisation: organisation } + + context 'unauthenticated' do + include_context 'iboo wrong authorisation api user' + + describe 'GET #index' do + it 'should not be successful' do + get :index, workbench_id: workbench.id + expect(response).not_to be_success + end + end + end + + context 'authenticated' do + include_context 'iboo authenticated api user' + + describe 'GET #index' do + it 'should be successful' do + get :index, workbench_id: workbench.id + expect(response).to be_success + end + end + + describe 'POST #create' do + let(:file) { fixture_file_upload('multiple_references_import.zip') } + + it 'should be successful' do + expect { + post :create, workbench_id: workbench.id, workbench_import: {file: file, creator: 'test'}, format: :json + }.to change{WorkbenchImport.count}.by(1) + expect(response).to be_success + end + end + end +end diff --git a/spec/controllers/api/v1/workbenches_controller_spec.rb b/spec/controllers/api/v1/workbenches_controller_spec.rb new file mode 100644 index 000000000..7780da142 --- /dev/null +++ b/spec/controllers/api/v1/workbenches_controller_spec.rb @@ -0,0 +1,25 @@ +require 'rails_helper' + +RSpec.describe Api::V1::WorkbenchesController, type: :controller do + context 'unauthenticated' do + include_context 'iboo wrong authorisation api user' + + describe 'GET #index' do + it 'should not be successful' do + get :index + expect(response).not_to be_success + end + end + end + + context 'authenticated' do + include_context 'iboo authenticated api user' + + describe 'GET #index' do + it 'should be successful' do + get :index + expect(response).to be_success + end + end + end +end diff --git a/spec/controllers/import_tasks_controller_spec.rb b/spec/controllers/import_tasks_controller_spec.rb deleted file mode 100644 index 17be1a8d7..000000000 --- a/spec/controllers/import_tasks_controller_spec.rb +++ /dev/null @@ -1,34 +0,0 @@ -require 'spec_helper' - -# describe ImportTasksController, :type => :controller do -# login_user -# shared_examples_for "referential dependant" do -# it "assigns referential as @referential" do -# expect(assigns[:referential]).to eq(referential) -# end -# end - -# describe "GET /new" do -# before(:each) do -# get :new, -# :referential_id => referential.id -# end -# it_behaves_like "referential dependant" -# it "should assign import_task with NeptuneImport instance" do -# expect(assigns[:import_task].class).to eq(NeptuneImport) -# end -# it "should assign import_task with Neptune format" do -# expect(assigns[:import_task].format).to eq(ImportTask.new.format) -# end -# it "should assign import_task with refrential.id" do -# expect(assigns[:import_task].referential_id).to eq(referential.id) -# end -# it "should assign import_task with logged in user id" do -# expect(assigns[:import_task].user_id).to eq(referential.organisation.users.first.id) -# end -# it "should assign import_task with logged in user name" do -# expect(assigns[:import_task].user_name).to eq(referential.organisation.users.first.name) -# end -# end - -# end diff --git a/spec/decorators/api_key_decorator_spec.rb b/spec/decorators/api_key_decorator_spec.rb new file mode 100644 index 000000000..9451a3974 --- /dev/null +++ b/spec/decorators/api_key_decorator_spec.rb @@ -0,0 +1,4 @@ +require 'spec_helper' + +describe ApiKeyDecorator do +end diff --git a/spec/factories/api_keys.rb b/spec/factories/api_keys.rb index bd31edecc..963938c64 100644 --- a/spec/factories/api_keys.rb +++ b/spec/factories/api_keys.rb @@ -1,6 +1,8 @@ FactoryGirl.define do factory :api_key, class: Api::V1::ApiKey do - token { "#{referential.id}-#{SecureRandom.hex}" } + name { SecureRandom.urlsafe_base64 } + token { "#{referential_id}-#{organisation_id}-#{SecureRandom.hex}" } referential + organisation end end 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_companies.rb b/spec/factories/chouette_companies.rb index 35ce34257..9272736cf 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| "STIF:CODIFLIGNE:Company:#{n}" } 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_group_of_lines.rb b/spec/factories/chouette_group_of_lines.rb index 75739d6d3..8b359fea5 100644 --- a/spec/factories/chouette_group_of_lines.rb +++ b/spec/factories/chouette_group_of_lines.rb @@ -2,7 +2,7 @@ FactoryGirl.define do factory :group_of_line, :class => Chouette::GroupOfLine do sequence(:name) { |n| "Group Of Line #{n}" } - sequence(:objectid) { |n| "chouette:test:GroupOfLine:#{n}" } + sequence(:objectid) { |n| "STIF:CODIFLIGNE:GroupOfLine:#{n}" } sequence(:registration_number) { |n| "#{n}" } association :line_referential diff --git a/spec/factories/chouette_journey_pattern.rb b/spec/factories/chouette_journey_pattern.rb index 62241f313..05d8d536a 100644 --- a/spec/factories/chouette_journey_pattern.rb +++ b/spec/factories/chouette_journey_pattern.rb @@ -5,8 +5,7 @@ FactoryGirl.define do 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| "organisation:JourneyPattern:lineId-#{n}:LOC" } association :route, :factory => :route factory :journey_pattern do diff --git a/spec/factories/chouette_networks.rb b/spec/factories/chouette_networks.rb index 3ad719cd9..afeac9e28 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| "STIF:CODIFLIGNE:Network:#{n}" } sequence(:registration_number) { |n| "test-#{n}" } association :line_referential diff --git a/spec/factories/chouette_routes.rb b/spec/factories/chouette_routes.rb index a707bcbf6..4986ab70e 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| "organisation:Route:lineId-routeId#{n}:LOC" } association :line, :factory => :line diff --git a/spec/factories/chouette_routing_constraint_zones.rb b/spec/factories/chouette_routing_constraint_zones.rb index 8ef2ddb43..7748a4f74 100644 --- a/spec/factories/chouette_routing_constraint_zones.rb +++ b/spec/factories/chouette_routing_constraint_zones.rb @@ -1,6 +1,7 @@ FactoryGirl.define do factory :routing_constraint_zone, class: Chouette::RoutingConstraintZone do sequence(:name) { |n| "Routing constraint zone #{n}" } + sequence(:objectid) { |n| "organisation:RoutingConstraintZone:lineId-routeId-#{n}:LOC" } association :route, factory: :route after(:build) do |zone| route = Chouette::Route.find(zone.route_id) 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 b410d4ab8..a3ff63b2f 100644 --- a/spec/factories/chouette_time_table.rb +++ b/spec/factories/chouette_time_table.rb @@ -1,7 +1,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| "organisation: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 d1e00cd1d..5f64bd502 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| "organisation:VehicleJourney:lineid-#{n}:LOC" } factory :vehicle_journey_empty do association :journey_pattern, :factory => :journey_pattern diff --git a/spec/factories/compliance_check_results.rb b/spec/factories/compliance_check_results.rb deleted file mode 100644 index 7a3a3e956..000000000 --- a/spec/factories/compliance_check_results.rb +++ /dev/null @@ -1,8 +0,0 @@ -FactoryGirl.define do - factory :compliance_check_result do - association :compliance_check_task - rule_code "2-NEPTUNE-StopArea-6" - severity "warning" - status "nok" - end -end diff --git a/spec/factories/compliance_check_tasks.rb b/spec/factories/compliance_check_tasks.rb deleted file mode 100644 index e9fdeb5ef..000000000 --- a/spec/factories/compliance_check_tasks.rb +++ /dev/null @@ -1,8 +0,0 @@ -FactoryGirl.define do - factory :compliance_check_task do - user_id 1 - user_name "Dummy" - status "pending" - referential { Referential.find_by_slug("first") } - end -end diff --git a/spec/factories/import_messages.rb b/spec/factories/import_messages.rb new file mode 100644 index 000000000..75f80566c --- /dev/null +++ b/spec/factories/import_messages.rb @@ -0,0 +1,7 @@ +FactoryGirl.define do + factory :import_message do + association :import + association :resource, factory: :import_resource + criticity :info + end +end diff --git a/spec/factories/import_resources.rb b/spec/factories/import_resources.rb index 6854dc4af..76afcc486 100644 --- a/spec/factories/import_resources.rb +++ b/spec/factories/import_resources.rb @@ -1,9 +1,9 @@ FactoryGirl.define do factory :import_resource do association :import - status :new + status :WARNING sequence(:name) { |n| "Import resource #{n}" } - type 'type' + resource_type 'type' reference 'reference' end end diff --git a/spec/factories/imports.rb b/spec/factories/imports.rb index afced3b57..2c53106c3 100644 --- a/spec/factories/imports.rb +++ b/spec/factories/imports.rb @@ -9,6 +9,7 @@ FactoryGirl.define do status :new started_at nil ended_at nil + creator 'rspec' after(:build) do |import| import.class.skip_callback(:create, :before, :initialize_fields) diff --git a/spec/features/connection_links_spec.rb b/spec/features/connection_links_spec.rb index 0325e6e1c..7272242fe 100644 --- a/spec/features/connection_links_spec.rb +++ b/spec/features/connection_links_spec.rb @@ -34,7 +34,7 @@ RSpec.describe "ConnectionLinks", :type => :feature do visit referential_connection_links_path(referential) click_link "Ajouter une correspondance" fill_in "Nom", :with => "ConnectionLink 1" - fill_in "Identifiant Neptune", :with => "test:ConnectionLink:1" + fill_in "Identifiant Neptune", :with => "test:ConnectionLink:1:LOC" click_button("Créer correspondance") expect(page).to have_content("ConnectionLink 1") end diff --git a/spec/features/referentials_spec.rb b/spec/features/referentials_spec.rb index 337271fea..a38577aba 100644 --- a/spec/features/referentials_spec.rb +++ b/spec/features/referentials_spec.rb @@ -120,6 +120,73 @@ describe "Referentials", :type => :feature do end + describe "new_from" do + # let(:cloning) + let(:worker) { ReferentialCloningWorker.new } + + let(:line) { create(:line_with_stop_areas) } + let(:jp) { create(:journey_pattern, route: line.routes.first) } + let(:tt) { create(:time_table) } + let(:vj) { create(:vehicle_journey, journey_pattern: jp, time_table: tt) } + let(:ref_metadata) { create(:referential_metadata, lines: [line], referential: referential) } + + context "when user is from the same organisation" do + + xit "should" do + visit new_referential_path(from: referential.id, current_workbench_id: @user.organisation.workbenches.first.id) + + select "2018", :from => "referential_metadatas_attributes_0_periods_attributes_0_begin_1i" + + select "2018", :from => "referential_metadatas_attributes_0_periods_attributes_0_end_1i" + + click_button "Valider" + + clone = Referential.where(name: "Copie de first") + + expect(clone.lines).to include(line) + expect(clone.lines.first.routes).to match_array(referential.lines.first.routes) + + clone_jp = clone.lines.first.routes.first.journey_patterns + expect(clone_jp).to include(jp) + + clone_vj = clone.lines.first.routes.first.journey_patterns.first.vehicle_journeys + expect(clone_vj).to include(vj) + + clone_tt = clone.lines.first.routes.first.journey_patterns.first.vehicle_journeys.first.time_tables + expect(clone_tt).to include(tt) + end + + # it "should have the lines from source" do + # expect(clone.lines).to include(line) + # end + # + # it "should have the routes from source" do + # expect(clone.lines.first.routes).to match_array(referential.lines.first.routes) + # end + # + # it "should have the journey patterns from source" do + # clone_jp = clone.lines.first.routes.first.journey_patterns + # expect(clone_jp).to include(jp) + # end + # + # it "should have the vehicle journeys from source" do + # clone_vj = clone.lines.first.routes.first.journey_patterns.first.vehicle_journeys + # expect(clone_vj).to include(vj) + # end + # + # it "should have the timetables from source" do + # clone_tt = clone.lines.first.routes.first.journey_patterns.first.vehicle_journeys.first.time_tables + # expect(clone_tt).to include(tt) + # end + end + + # context "when user is from another organisation" do + # before :each do + # + # end + # end + end + describe "destroy" do let(:referential) { create(:referential, :organisation => @user.organisation) } diff --git a/spec/features/workbenches_spec.rb b/spec/features/workbenches_spec.rb index 536469a46..14809dec1 100644 --- a/spec/features/workbenches_spec.rb +++ b/spec/features/workbenches_spec.rb @@ -178,16 +178,24 @@ describe 'Workbenches', type: :feature do end describe 'create new Referential' do + #TODO Manage functional_scope it "create a new Referential with a specifed line and period" do - referential.destroy + skip "The functional scope for the Line collection causes problems" do + functional_scope = JSON.generate(Chouette::Line.all.map(&:objectid)) + lines = Chouette::Line.where(objectid: functional_scope) - visit workbench_path(workbench) - click_link I18n.t('actions.add') - fill_in "referential[name]", with: "Referential to test creation" - select workbench.lines.first.id, from: 'referential[metadatas_attributes][0][lines][]' + @user.organisation.update_attribute(:sso_attributes, { functional_scope: functional_scope } ) + ref_metadata.update_attribute(:line_ids, lines.map(&:id)) + + referential.destroy + visit workbench_path(workbench) + click_link I18n.t('actions.add') + fill_in "referential[name]", with: "Referential to test creation" + select ref_metadata.line_ids.first, from: 'referential[metadatas_attributes][0][lines][]' - click_button "Valider" - expect(page).to have_css("h1", text: "Referential to test creation") + click_button "Valider" + expect(page).to have_css("h1", text: "Referential to test creation") + end end end end diff --git a/spec/fixtures/OFFRE_TRANSDEV_2017030112251.zip b/spec/fixtures/OFFRE_TRANSDEV_2017030112251.zip Binary files differnew file mode 100644 index 000000000..566cc5b0b --- /dev/null +++ b/spec/fixtures/OFFRE_TRANSDEV_2017030112251.zip diff --git a/spec/fixtures/single_reference_import.zip b/spec/fixtures/single_reference_import.zip Binary files differindex 4aee23614..37a516f69 100644 --- a/spec/fixtures/single_reference_import.zip +++ b/spec/fixtures/single_reference_import.zip diff --git a/spec/fixtures/source_OFFRE_TRANSDEV_20170301122517/calendriers.xml b/spec/fixtures/source_OFFRE_TRANSDEV_20170301122517/calendriers.xml new file mode 100644 index 000000000..bfbd0aea1 --- /dev/null +++ b/spec/fixtures/source_OFFRE_TRANSDEV_20170301122517/calendriers.xml @@ -0,0 +1,86 @@ +<?xml version="1.0" encoding="UTF-8"?> +<netex:PublicationDelivery xmlns:netex="http://www.netex.org.uk/netex" + xmlns:siri="http://www.siri.org.uk/siri" xmlns:core="http://www.govtalk.gov.uk/core" + xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:ifopt="http://www.ifopt.org.uk/ifopt" + xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + version="1.0"> + <netex:PublicationTimestamp>2017-02-14T09:13:51.0</netex:PublicationTimestamp> + <netex:ParticipantRef>CITYWAY</netex:ParticipantRef> + <netex:dataObjects> + <netex:GeneralFrame id="CITYWAY:GeneralFrame:NETEX_CALENDRIER-1_20170214090012:LOC" + version="any"> + <netex:TypeOfFrameRef ref="NETEX_CALENDRIER"/> + <netex:ValidBetween> + <netex:FromDate>2017-03-01</netex:FromDate> + <netex:ToDate>2017-03-31</netex:ToDate> + </netex:ValidBetween> + <netex:members> + <netex:dayTypes> + <netex:DayType id="CITYWAY:DayType:1:LOC" version="any" > + <netex:Name>Semaine</netex:Name> + <netex:properties> + <netex:PropertyOfDay> + <netex:DaysOfWeek>Monday</netex:DaysOfWeek> + </netex:PropertyOfDay> + <netex:PropertyOfDay> + <netex:DaysOfWeek>Tuesday</netex:DaysOfWeek> + </netex:PropertyOfDay> + <netex:PropertyOfDay> + <netex:DaysOfWeek>Wednesday</netex:DaysOfWeek> + </netex:PropertyOfDay> + <netex:PropertyOfDay> + <netex:DaysOfWeek>Thursday</netex:DaysOfWeek> + </netex:PropertyOfDay> + <netex:PropertyOfDay> + <netex:DaysOfWeek>Friday</netex:DaysOfWeek> + </netex:PropertyOfDay> + </netex:properties> + </netex:DayType> + <netex:DayType id="CITYWAY:DayType:2:LOC" version="any" > + <netex:Name>Fin de semaine</netex:Name> + <netex:properties> + <netex:PropertyOfDay> + <netex:DaysOfWeek>Saturday</netex:DaysOfWeek> + </netex:PropertyOfDay> + <netex:PropertyOfDay> + <netex:DaysOfWeek>Sunday</netex:DaysOfWeek> + </netex:PropertyOfDay> + </netex:properties> + </netex:DayType> + <netex:DayType id="CITYWAY:DayType:3:LOC" version="any" > + <netex:Name>Service spécial</netex:Name> + </netex:DayType> + <netex:DayType id="CITYWAY:DayType:4:LOC" version="any" > + <netex:Name>Restriction</netex:Name> + </netex:DayType> + </netex:dayTypes> + <netex:dayTypeAssignments> + <netex:DayTypeAssignment version="any" > + <netex:OperatingPeriodRef ref="CITYWAY:OperatingPeriod:1:LOC" version="any"/> + <netex:DayTypeRef ref="CITYWAY:DayType:1:LOC" version="any"/> + </netex:DayTypeAssignment> + <netex:DayTypeAssignment version="any" > + <netex:OperatingPeriodRef ref="CITYWAY:OperatingPeriod:1:LOC" version="any"/> + <netex:DayTypeRef ref="CITYWAY:DayType:2:LOC" version="any"/> + </netex:DayTypeAssignment> + <netex:DayTypeAssignment version="any" > + <netex:Date>2017-03-15</netex:Date> + <netex:DayTypeRef ref="CITYWAY:DayType:3:LOC" version="any"/> + <netex:isAvailable>true</netex:isAvailable> + </netex:DayTypeAssignment> + <netex:DayTypeAssignment version="any" > + <netex:Date>2017-03-15</netex:Date> + <netex:DayTypeRef ref="CITYWAY:DayType:4:LOC" version="any"/> + <netex:isAvailable>false</netex:isAvailable> + </netex:DayTypeAssignment> + </netex:dayTypeAssignments> + <netex:operatingPeriods> + <netex:OperatingPeriod id="CITYWAY:OperatingPeriod:1:LOC" version="any" > + <netex:FromDate>2017-01-01</netex:FromDate> + <netex:ToDate>2017-12-31</netex:ToDate> + </netex:OperatingPeriod> + </netex:operatingPeriods> + </netex:members> + </netex:GeneralFrame> + </netex:dataObjects> +</netex:PublicationDelivery> diff --git a/spec/fixtures/source_OFFRE_TRANSDEV_20170301122517/commun.xml b/spec/fixtures/source_OFFRE_TRANSDEV_20170301122517/commun.xml new file mode 100644 index 000000000..266c8a598 --- /dev/null +++ b/spec/fixtures/source_OFFRE_TRANSDEV_20170301122517/commun.xml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?> +<netex:PublicationDelivery xmlns:netex="http://www.netex.org.uk/netex" + xmlns:siri="http://www.siri.org.uk/siri" xmlns:core="http://www.govtalk.gov.uk/core" + xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:ifopt="http://www.ifopt.org.uk/ifopt" + xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + version="1.0"> + <netex:PublicationTimestamp>2017-02-14T09:13:51.0</netex:PublicationTimestamp> + <netex:ParticipantRef>CITYWAY</netex:ParticipantRef> + <netex:dataObjects> + <netex:GeneralFrame id="CITYWAY:GeneralFrame:NETEX_COMMUN-1_20170214090012:LOC" version="any"> + <netex:TypeOfFrameRef ref="NETEX_COMMUN"/> + <netex:members> + <netex:notices> + <netex:Notice id="CITYWAY:Notice:1:LOC" version="any"> + <netex:Text>Notice 1</netex:Text> + <netex:PublicCode>1</netex:PublicCode> + <netex:TypeOfNoticeRef>ServiceJourneyNotice</netex:TypeOfNoticeRef> + </netex:Notice> + <netex:Notice id="CITYWAY:Notice:2:LOC" version="any"> + <netex:Text>Notice 2</netex:Text> + <netex:PublicCode>2</netex:PublicCode> + <netex:TypeOfNoticeRef>ServiceJourneyNotice</netex:TypeOfNoticeRef> + </netex:Notice> + <netex:Notice id="CITYWAY:Notice:3:LOC" version="any"> + <netex:Text>Notice 3</netex:Text> + <netex:PublicCode>3</netex:PublicCode> + <netex:TypeOfNoticeRef>ServiceJourneyNotice</netex:TypeOfNoticeRef> + </netex:Notice> + </netex:notices> + </netex:members> + </netex:GeneralFrame> + </netex:dataObjects> +</netex:PublicationDelivery> diff --git a/spec/fixtures/source_OFFRE_TRANSDEV_20170301122517/offre_C00108_9.xml b/spec/fixtures/source_OFFRE_TRANSDEV_20170301122517/offre_C00108_9.xml new file mode 100644 index 000000000..832793036 --- /dev/null +++ b/spec/fixtures/source_OFFRE_TRANSDEV_20170301122517/offre_C00108_9.xml @@ -0,0 +1,202 @@ +<?xml version="1.0" encoding="UTF-8"?> +<netex:PublicationDelivery xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.netex.org.uk/netex ../../xsd/NeTEx_publication.xsd" + xmlns:netex="http://www.netex.org.uk/netex" xmlns:xlink="http://www.w3.org/1999/xlink" + xmlns:ifopt="http://www.ifopt.org.uk/ifopt" xmlns:gml="http://www.opengis.net/gml/3.2" + xmlns:core="http://www.govtalk.gov.uk/core" xmlns:siri="http://www.siri.org.uk/siri" version="1.0"> + <netex:PublicationTimestamp>2017-02-14T09:13:51.0</netex:PublicationTimestamp> + <netex:ParticipantRef>CITYWAY</netex:ParticipantRef> + <netex:dataObjects> + <netex:CompositeFrame id="CITYWAY:CompositeFrame:NETEX_OFFRE_LIGNE-1:LOC" version="any"> + <netex:Name>Ligne 1</netex:Name> + <netex:TypeOfFrameRef ref="NETEX_OFFRE_LIGNE"/> + <netex:frames> + <netex:GeneralFrame id="CITYWAY:GeneralFrame:NETEX_STRUCTURE-20170214090012:LOC" + version="any"> + <netex:TypeOfFrameRef ref="NETEX_STRUCTURE"/> + <netex:members> + <netex:routes> + <netex:Route id="CITYWAY:Route:1:LOC" version="any"> + <netex:Name>route 1</netex:Name> + <netex:LineRef ref="STIF:CODIFLIGNE:Line:C00108">version="any"</netex:LineRef> + <netex:DirectionType>outbound</netex:DirectionType> + <netex:DirectionRef ref="CITYWAY:Direction:1:LOC" version="any"/> + <netex:InverseRouteRef ref="CITYWAY:Route:2:LOC" version="any"/> + </netex:Route> + <netex:Route id="CITYWAY:Route:2:LOC" version="any"> + <netex:Name>route 2</netex:Name> + <netex:LineRef ref="STIF:CODIFLIGNE:Line:C00108">version="any"</netex:LineRef> + <netex:DirectionType>inbound</netex:DirectionType> + <netex:DirectionRef ref="CITYWAY:Direction:2:LOC" version="any"/> + <netex:InverseRouteRef ref="CITYWAY:Route:1:LOC" version="any"/> + </netex:Route> + </netex:routes> + <netex:directions> + <netex:Direction id="CITYWAY:Direction:1:LOC" version="any"> + <netex:Name>Par ici</netex:Name> + </netex:Direction> + <netex:Direction id="CITYWAY:Direction:2:LOC" version="any"> + <netex:Name>Par là </netex:Name> + </netex:Direction> + </netex:directions> + <netex:serviceJourneyPatterns> + <netex:ServiceJourneyPattern id="CITYWAY:ServiceJourneyPattern:1:LOC" + version="any"> + <netex:Name>Par ici</netex:Name> + <netex:RouteRef ref="CITYWAY:Route:1:LOC" version="any"/> + <netex:DestinationDisplayRef ref="CITYWAY:DestinationDisplay:1:LOC" + version="any"/> + <netex:pointsInSequence> + <netex:StopPointInJourneyPattern + id="CITYWAY:StopPointInJourneyPattern:1-1-1:LOC" order="1" + version="any"> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:1-1:LOC" version="any"/> + <netex:ForAlighting>true</netex:ForAlighting> + <netex:ForBoarding>true</netex:ForBoarding> + </netex:StopPointInJourneyPattern> + <netex:StopPointInJourneyPattern + id="CITYWAY:StopPointInJourneyPattern:1-1-2:LOC" order="2" + version="any"> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:1-2:LOC" version="any"/> + <netex:ForAlighting>true</netex:ForAlighting> + <netex:ForBoarding>true</netex:ForBoarding> + </netex:StopPointInJourneyPattern> + </netex:pointsInSequence> + <netex:ServiceJourneyPatternType>passenger</netex:ServiceJourneyPatternType> + </netex:ServiceJourneyPattern> + <netex:ServiceJourneyPattern id="CITYWAY:ServiceJourneyPattern:2:LOC" + version="any"> + <netex:Name>Par là </netex:Name> + <netex:RouteRef ref="CITYWAY:Route:2:LOC" version="any"/> + <netex:DestinationDisplayRef ref="CITYWAY:DestinationDisplay:2:LOC" + version="any"/> + <netex:pointsInSequence> + <netex:StopPointInJourneyPattern + id="CITYWAY:StopPointInJourneyPattern:2-2-1:LOC" order="1" + version="any"> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:2-1:LOC" version="any"/> + <netex:ForAlighting>true</netex:ForAlighting> + <netex:ForBoarding>true</netex:ForBoarding> + </netex:StopPointInJourneyPattern> + <netex:StopPointInJourneyPattern + id="CITYWAY:StopPointInJourneyPattern:2-2-2:LOC" order="2" + version="any"> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:2-2:LOC" version="any"/> + <netex:ForAlighting>true</netex:ForAlighting> + <netex:ForBoarding>true</netex:ForBoarding> + </netex:StopPointInJourneyPattern> + </netex:pointsInSequence> + <netex:ServiceJourneyPatternType>passenger</netex:ServiceJourneyPatternType> + </netex:ServiceJourneyPattern> + </netex:serviceJourneyPatterns> + <netex:destinationDisplays> + <netex:DestinationDisplay id="CITYWAY:DestinationDisplay:1:LOC" + version="any"> + <netex:FrontText>Mission 1</netex:FrontText> + <netex:PublicCode>1234</netex:PublicCode> + </netex:DestinationDisplay> + <netex:DestinationDisplay id="CITYWAY:DestinationDisplay:2:LOC" + version="any"> + <netex:FrontText>Mission 2</netex:FrontText> + <netex:PublicCode>2345</netex:PublicCode> + </netex:DestinationDisplay> + </netex:destinationDisplays> + <netex:scheduledStopPoints> + <netex:ScheduledStopPoint id="CITYWAY:ScheduledStopPoint:1-1:LOC" + version="any"/> + <netex:ScheduledStopPoint id="CITYWAY:ScheduledStopPoint:1-2:LOC" + version="any"/> + <netex:ScheduledStopPoint id="CITYWAY:ScheduledStopPoint:2-1:LOC" + version="any"/> + <netex:ScheduledStopPoint id="CITYWAY:ScheduledStopPoint:2-2:LOC" + version="any"/> + </netex:scheduledStopPoints> + <netex:passengerStopAssignments> + <netex:PassengerStopAssignment + id="CITYWAY:PassengerStopAssignment:1-1:LOC" version="any"> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:1-1:LOC" version="any"/> + <netex:QuayRef ref="FR:78217:ZDE:50094817:STIF">version="any"</netex:QuayRef> + </netex:PassengerStopAssignment> + <netex:PassengerStopAssignment + id="CITYWAY:PassengerStopAssignment:2-1:LOC" version="any"> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:2-1:LOC" version="any"/> + <netex:QuayRef ref="FR:78217:ZDE:50009052:STIF">version="any"</netex:QuayRef> + </netex:PassengerStopAssignment> + <netex:PassengerStopAssignment + id="CITYWAY:PassengerStopAssignment:1-2:LOC" version="any"> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:1-2:LOC" version="any"/> + <netex:QuayRef ref="FR:78217:ZDE:50009053:STIF">version="any"</netex:QuayRef> + </netex:PassengerStopAssignment> + <netex:PassengerStopAssignment + id="CITYWAY:PassengerStopAssignment:2-2:LOC" version="any"> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:2-2:LOC" version="any"/> + <netex:QuayRef ref="FR:78217:ZDE:50094816:STIF">version="any"</netex:QuayRef> + </netex:PassengerStopAssignment> + </netex:passengerStopAssignments> + <netex:routingConstraintZones> + <netex:RoutingConstraintZone id="CITYWAY:RoutingConstraintZone:1:LOC" + version="any"> + <netex:Name>ITL 1</netex:Name> + <netex:members> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:1-1:LOC" version="any"/> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:2-1:LOC" version="any"/> + </netex:members> + <netex:ZoneUse>cannotBoardAndAlightInSameZone</netex:ZoneUse> + </netex:RoutingConstraintZone> + </netex:routingConstraintZones> + </netex:members> + </netex:GeneralFrame> + <netex:GeneralFrame id="CITYWAY:GeneralFrame:NETEX_HORAIRE-20170214090012:LOC" + version="any"> + <netex:TypeOfFrameRef ref="NETEX_HORAIRE"/> + <netex:members> + <netex:serviceJourneys> + <netex:ServiceJourney id="CITYWAY:ServiceJourney:1-1:LOC" version="any"> + <netex:Name>Course 1 par ici</netex:Name> + <netex:noticeAssignments> + <netex:NoticeAssignment> + <netex:NoticeRef ref="CITYWAY:Notice:1:LOC"> + version="any"</netex:NoticeRef> + </netex:NoticeAssignment> + </netex:noticeAssignments> + <netex:DayTypeRef ref="CITYWAY:DayType:1:LOC"> + version="any"</netex:DayTypeRef> + <netex:JourneyPatternRef ref="CITYWAY:ServiceJourneyPattern:1:LOC" + version="any"/> + <netex:OperatorRef ref="STIF:CODIFLIGNE:Operator:011"> + version="any"</netex:OperatorRef> + <netex:trainNumbers> + <netex:TrainNumberRef ref="CITYWAY:TrainNumber:1234:LOC">version="any"</netex:TrainNumberRef> + </netex:trainNumbers> + <netex:passingTimes> + <netex:TimetabledPassingTime version="any"> + <netex:ArrivalTime>01:01:00.000</netex:ArrivalTime> + <netex:ArrivalDayOffset>0</netex:ArrivalDayOffset> + <netex:DepartureTime>01:01:00.000</netex:DepartureTime> + <netex:DepartureDayOffset>0</netex:DepartureDayOffset> + </netex:TimetabledPassingTime> + <netex:TimetabledPassingTime version="any"> + <netex:ArrivalTime>01:05:00.000</netex:ArrivalTime> + <netex:ArrivalDayOffset>0</netex:ArrivalDayOffset> + <netex:DepartureTime>01:05:00.000</netex:DepartureTime> + <netex:DepartureDayOffset>0</netex:DepartureDayOffset> + </netex:TimetabledPassingTime> + </netex:passingTimes> + </netex:ServiceJourney> + </netex:serviceJourneys> + </netex:members> + </netex:GeneralFrame> + </netex:frames> + </netex:CompositeFrame> + </netex:dataObjects> +</netex:PublicationDelivery> diff --git a/spec/fixtures/source_OFFRE_TRANSDEV_20170301122517/offre_C00109_10.xml b/spec/fixtures/source_OFFRE_TRANSDEV_20170301122517/offre_C00109_10.xml new file mode 100644 index 000000000..9dff0d850 --- /dev/null +++ b/spec/fixtures/source_OFFRE_TRANSDEV_20170301122517/offre_C00109_10.xml @@ -0,0 +1,204 @@ +<?xml version="1.0" encoding="UTF-8"?> +<netex:PublicationDelivery xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.netex.org.uk/netex ../../xsd/NeTEx_publication.xsd" + xmlns:netex="http://www.netex.org.uk/netex" xmlns:xlink="http://www.w3.org/1999/xlink" + xmlns:ifopt="http://www.ifopt.org.uk/ifopt" xmlns:gml="http://www.opengis.net/gml/3.2" + xmlns:core="http://www.govtalk.gov.uk/core" xmlns:siri="http://www.siri.org.uk/siri" version="1.0"> + <netex:PublicationTimestamp>2017-02-14T09:13:51.0</netex:PublicationTimestamp> + <netex:ParticipantRef>CITYWAY</netex:ParticipantRef> + <netex:dataObjects> + <netex:CompositeFrame id="CITYWAY:CompositeFrame:NETEX_OFFRE_LIGNE-1:LOC" version="any"> + <netex:Name>Ligne 1</netex:Name> + <netex:TypeOfFrameRef ref="NETEX_OFFRE_LIGNE"/> + <netex:frames> + <netex:GeneralFrame id="CITYWAY:GeneralFrame:NETEX_STRUCTURE-20170214090012:LOC" + version="any"> + <netex:TypeOfFrameRef ref="NETEX_STRUCTURE"/> + <netex:members> + <netex:routes> + <netex:Route id="CITYWAY:Route:1:LOC" version="any"> + <netex:Name>route 1</netex:Name> + <netex:LineRef ref="STIF:CODIFLIGNE:Line:C00109">version="any"</netex:LineRef> + <netex:DirectionType>outbound</netex:DirectionType> + <netex:DirectionRef ref="CITYWAY:Direction:1:LOC" version="any"/> + <netex:InverseRouteRef ref="CITYWAY:Route:2:LOC" version="any"/> + </netex:Route> + <netex:Route id="CITYWAY:Route:2:LOC" version="any"> + <netex:Name>route 2</netex:Name> + <netex:LineRef ref="STIF:CODIFLIGNE:Line:C00109">version="any"</netex:LineRef> + <netex:DirectionType>inbound</netex:DirectionType> + <netex:DirectionRef ref="CITYWAY:Direction:2:LOC" version="any"/> + <netex:InverseRouteRef ref="CITYWAY:Route:1:LOC" version="any"/> + </netex:Route> + </netex:routes> + <netex:directions> + <netex:Direction id="CITYWAY:Direction:1:LOC" version="any"> + <netex:Name>Par ici aussi</netex:Name> + </netex:Direction> + <netex:Direction id="CITYWAY:Direction:2:LOC" version="any"> + <netex:Name>Par là aussi</netex:Name> + </netex:Direction> + </netex:directions> + <netex:serviceJourneyPatterns> + <netex:ServiceJourneyPattern id="CITYWAY:ServiceJourneyPattern:1:LOC" + version="any"> + <netex:Name>Par ici itou</netex:Name> + <netex:RouteRef ref="CITYWAY:Route:1:LOC" version="any"/> + <netex:DestinationDisplayRef ref="CITYWAY:DestinationDisplay:1:LOC" + version="any"/> + <netex:pointsInSequence> + <netex:StopPointInJourneyPattern + id="CITYWAY:StopPointInJourneyPattern:1-1-1:LOC" order="1" + version="any"> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:1-1:LOC" version="any"/> + <netex:ForAlighting>true</netex:ForAlighting> + <netex:ForBoarding>true</netex:ForBoarding> + </netex:StopPointInJourneyPattern> + <netex:StopPointInJourneyPattern + id="CITYWAY:StopPointInJourneyPattern:1-1-2:LOC" order="2" + version="any"> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:1-2:LOC" version="any"/> + <netex:ForAlighting>true</netex:ForAlighting> + <netex:ForBoarding>true</netex:ForBoarding> + </netex:StopPointInJourneyPattern> + </netex:pointsInSequence> + <netex:ServiceJourneyPatternType>passenger</netex:ServiceJourneyPatternType> + </netex:ServiceJourneyPattern> + <netex:ServiceJourneyPattern id="CITYWAY:ServiceJourneyPattern:2:LOC" + version="any"> + <netex:Name>Par là itou</netex:Name> + <netex:RouteRef ref="CITYWAY:Route:2:LOC" version="any"/> + <netex:DestinationDisplayRef ref="CITYWAY:DestinationDisplay:2:LOC" + version="any"/> + <netex:pointsInSequence> + <netex:StopPointInJourneyPattern + id="CITYWAY:StopPointInJourneyPattern:2-2-1:LOC" order="1" + version="any"> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:2-1:LOC" version="any"/> + <netex:ForAlighting>true</netex:ForAlighting> + <netex:ForBoarding>true</netex:ForBoarding> + </netex:StopPointInJourneyPattern> + <netex:StopPointInJourneyPattern + id="CITYWAY:StopPointInJourneyPattern:2-2-2:LOC" order="2" + version="any"> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:2-2:LOC" version="any"/> + <netex:ForAlighting>true</netex:ForAlighting> + <netex:ForBoarding>true</netex:ForBoarding> + </netex:StopPointInJourneyPattern> + </netex:pointsInSequence> + <netex:ServiceJourneyPatternType>passenger</netex:ServiceJourneyPatternType> + </netex:ServiceJourneyPattern> + </netex:serviceJourneyPatterns> + <netex:destinationDisplays> + <netex:DestinationDisplay id="CITYWAY:DestinationDisplay:1:LOC" + version="any"> + <netex:FrontText>Mission 1 bis</netex:FrontText> + <netex:PublicCode>1234</netex:PublicCode> + </netex:DestinationDisplay> + <netex:DestinationDisplay id="CITYWAY:DestinationDisplay:2:LOC" + version="any"> + <netex:FrontText>Mission 2 bis</netex:FrontText> + <netex:PublicCode>2345</netex:PublicCode> + </netex:DestinationDisplay> + </netex:destinationDisplays> + <netex:scheduledStopPoints> + <netex:ScheduledStopPoint id="CITYWAY:ScheduledStopPoint:1-1:LOC" + version="any"/> + <netex:ScheduledStopPoint id="CITYWAY:ScheduledStopPoint:1-2:LOC" + version="any"/> + <netex:ScheduledStopPoint id="CITYWAY:ScheduledStopPoint:2-1:LOC" + version="any"/> + <netex:ScheduledStopPoint id="CITYWAY:ScheduledStopPoint:2-2:LOC" + version="any"/> + </netex:scheduledStopPoints> + <netex:passengerStopAssignments> + <netex:PassengerStopAssignment + id="CITYWAY:PassengerStopAssignment:1-1:LOC" version="any"> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:1-1:LOC" version="any"/> + <netex:QuayRef ref="FR:78217:ZDE:50094817:STIF">version="any"</netex:QuayRef> + </netex:PassengerStopAssignment> + <netex:PassengerStopAssignment + id="CITYWAY:PassengerStopAssignment:2-1:LOC" version="any"> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:2-1:LOC" version="any"/> + <netex:QuayRef ref="FR:78402:ZDE:50000918:STIF">version="any"</netex:QuayRef> + </netex:PassengerStopAssignment> + <netex:PassengerStopAssignment + id="CITYWAY:PassengerStopAssignment:1-2:LOC" version="any"> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:1-2:LOC" version="any"/> + <netex:QuayRef ref="FR:78402:ZDE:50000917:STIF">version="any"</netex:QuayRef> + </netex:PassengerStopAssignment> + <netex:PassengerStopAssignment + id="CITYWAY:PassengerStopAssignment:2-2:LOC" version="any"> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:2-2:LOC" version="any"/> + <netex:QuayRef ref="FR:78217:ZDE:50094816:STIF">version="any"</netex:QuayRef> + </netex:PassengerStopAssignment> + </netex:passengerStopAssignments> + <netex:routingConstraintZones> + <netex:RoutingConstraintZone id="CITYWAY:RoutingConstraintZone:1:LOC" + version="any"> + <netex:Name>ITL 1</netex:Name> + <netex:members> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:1-1:LOC" version="any"/> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:2-1:LOC" version="any"/> + </netex:members> + <netex:ZoneUse>cannotBoardAndAlightInSameZone</netex:ZoneUse> + </netex:RoutingConstraintZone> + </netex:routingConstraintZones> + </netex:members> + </netex:GeneralFrame> + <netex:GeneralFrame id="CITYWAY:GeneralFrame:NETEX_HORAIRE-20170214090012:LOC" + version="any"> + <netex:TypeOfFrameRef ref="NETEX_HORAIRE"/> + <netex:members> + <netex:serviceJourneys> + <netex:ServiceJourney id="CITYWAY:ServiceJourney:1-1:LOC" version="any"> + <netex:Name>Course 1 par ici aussi</netex:Name> + <netex:noticeAssignments> + <netex:NoticeAssignment> + <netex:NoticeRef ref="CITYWAY:Notice:2:LOC"> + version="any"</netex:NoticeRef> + </netex:NoticeAssignment> + </netex:noticeAssignments> + <netex:DayTypeRef ref="CITYWAY:DayType:1:LOC"> + version="any"</netex:DayTypeRef> + <netex:DayTypeRef ref="CITYWAY:DayType:4:LOC"> + version="any"</netex:DayTypeRef> + <netex:JourneyPatternRef ref="CITYWAY:ServiceJourneyPattern:1:LOC" + version="any"/> + <netex:OperatorRef ref="STIF:CODIFLIGNE:Operator:212"> + version="any"</netex:OperatorRef> + <netex:trainNumbers> + <netex:TrainNumberRef ref="CITYWAY:TrainNumber:1234:LOC">version="any"</netex:TrainNumberRef> + </netex:trainNumbers> + <netex:passingTimes> + <netex:TimetabledPassingTime version="any"> + <netex:ArrivalTime>23:58:00.000</netex:ArrivalTime> + <netex:ArrivalDayOffset>0</netex:ArrivalDayOffset> + <netex:DepartureTime>23:59:00.000</netex:DepartureTime> + <netex:DepartureDayOffset>0</netex:DepartureDayOffset> + </netex:TimetabledPassingTime> + <netex:TimetabledPassingTime version="any"> + <netex:ArrivalTime>00:03:00.000</netex:ArrivalTime> + <netex:ArrivalDayOffset>1</netex:ArrivalDayOffset> + <netex:DepartureTime>00:04:00.000</netex:DepartureTime> + <netex:DepartureDayOffset>1</netex:DepartureDayOffset> + </netex:TimetabledPassingTime> + </netex:passingTimes> + </netex:ServiceJourney> + </netex:serviceJourneys> + </netex:members> + </netex:GeneralFrame> + </netex:frames> + </netex:CompositeFrame> + </netex:dataObjects> +</netex:PublicationDelivery> diff --git a/spec/fixtures/source_OFFRE_TRANSDEV_20170301122519/calendriers.xml b/spec/fixtures/source_OFFRE_TRANSDEV_20170301122519/calendriers.xml new file mode 100644 index 000000000..1043e0cde --- /dev/null +++ b/spec/fixtures/source_OFFRE_TRANSDEV_20170301122519/calendriers.xml @@ -0,0 +1,80 @@ +<?xml version="1.0" encoding="UTF-8"?> +<netex:PublicationDelivery xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.netex.org.uk/netex ../../xsd/NeTEx_publication.xsd" xmlns:netex="http://www.netex.org.uk/netex" + xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ifopt="http://www.ifopt.org.uk/ifopt" + xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:core="http://www.govtalk.gov.uk/core" + xmlns:siri="http://www.siri.org.uk/siri" version="1.0"> + <netex:PublicationTimestamp>2017-02-14T09:13:51.0</netex:PublicationTimestamp> + <netex:ParticipantRef>CITYWAY</netex:ParticipantRef> + <netex:dataObjects> + <netex:GeneralFrame id="CITYWAY:GeneralFrame:NETEX_CALENDRIER-1_20170214090012:LOC" version="any"> + <netex:ValidBetween> + <netex:FromDate>2017-04-01T00:00:00</netex:FromDate> + <netex:ToDate>2017-12-31T00:00:00</netex:ToDate> + </netex:ValidBetween> + <netex:TypeOfFrameRef ref="NETEX_CALENDRIER"/> + <netex:members> + <netex:DayType id="CITYWAY:DayType:1:LOC" version="any"> + <netex:Name>Semaine</netex:Name> + <netex:properties> + <netex:PropertyOfDay> + <netex:DaysOfWeek>Monday</netex:DaysOfWeek> + </netex:PropertyOfDay> + <netex:PropertyOfDay> + <netex:DaysOfWeek>Tuesday</netex:DaysOfWeek> + </netex:PropertyOfDay> + <netex:PropertyOfDay> + <netex:DaysOfWeek>Wednesday</netex:DaysOfWeek> + </netex:PropertyOfDay> + <netex:PropertyOfDay> + <netex:DaysOfWeek>Thursday</netex:DaysOfWeek> + </netex:PropertyOfDay> + <netex:PropertyOfDay> + <netex:DaysOfWeek>Friday</netex:DaysOfWeek> + </netex:PropertyOfDay> + </netex:properties> + </netex:DayType> + <netex:DayType id="CITYWAY:DayType:2:LOC" version="any"> + <netex:Name>Fin de semaine</netex:Name> + <netex:properties> + <netex:PropertyOfDay> + <netex:DaysOfWeek>Saturday</netex:DaysOfWeek> + </netex:PropertyOfDay> + <netex:PropertyOfDay> + <netex:DaysOfWeek>Sunday</netex:DaysOfWeek> + </netex:PropertyOfDay> + </netex:properties> + </netex:DayType> + <netex:DayType id="CITYWAY:DayType:3:LOC" version="any"> + <netex:Name>Service spécial</netex:Name> + </netex:DayType> + <netex:DayType id="CITYWAY:DayType:4:LOC" version="any"> + <netex:Name>Restriction</netex:Name> + </netex:DayType> + <netex:DayTypeAssignment id="dta1" version="any" order="0"> + <netex:OperatingPeriodRef ref="CITYWAY:OperatingPeriod:1:LOC" version="any"/> + <netex:DayTypeRef ref="CITYWAY:DayType:1:LOC" version="any"/> + </netex:DayTypeAssignment> + <netex:DayTypeAssignment id="dta2" version="any" order="0"> + <netex:OperatingPeriodRef ref="CITYWAY:OperatingPeriod:1:LOC" version="any"/> + <netex:DayTypeRef ref="CITYWAY:DayType:2:LOC" version="any"/> + </netex:DayTypeAssignment> + <netex:DayTypeAssignment id="dta3" version="any" order="0"> + <netex:Date>2017-03-15</netex:Date> + <netex:DayTypeRef ref="CITYWAY:DayType:3:LOC" version="any"/> + <netex:isAvailable>true</netex:isAvailable> + </netex:DayTypeAssignment> + <netex:DayTypeAssignment id="dta4" version="any" order="0"> + <netex:Date>2017-03-15</netex:Date> + <netex:DayTypeRef ref="CITYWAY:DayType:4:LOC" version="any"/> + <netex:isAvailable>false</netex:isAvailable> + </netex:DayTypeAssignment> + <netex:OperatingPeriod id="CITYWAY:OperatingPeriod:1:LOC" version="any"> + <netex:FromDate>2017-01-01T00:00:00</netex:FromDate> + <netex:ToDate>2017-12-31T00:00:00</netex:ToDate> + </netex:OperatingPeriod> + + </netex:members> + </netex:GeneralFrame> + </netex:dataObjects> +</netex:PublicationDelivery> diff --git a/spec/fixtures/source_OFFRE_TRANSDEV_20170301122519/commun.xml b/spec/fixtures/source_OFFRE_TRANSDEV_20170301122519/commun.xml new file mode 100644 index 000000000..f59f8ac2d --- /dev/null +++ b/spec/fixtures/source_OFFRE_TRANSDEV_20170301122519/commun.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<netex:PublicationDelivery xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.netex.org.uk/netex ../../xsd/NeTEx_publication.xsd" xmlns:netex="http://www.netex.org.uk/netex" + xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ifopt="http://www.ifopt.org.uk/ifopt" xmlns:gml="http://www.opengis.net/gml/3.2" + xmlns:core="http://www.govtalk.gov.uk/core" xmlns:siri="http://www.siri.org.uk/siri" version="1.0"> + <netex:PublicationTimestamp>2017-02-14T09:13:51.0</netex:PublicationTimestamp> + <netex:ParticipantRef>CITYWAY</netex:ParticipantRef> + <netex:dataObjects> + <netex:GeneralFrame id="CITYWAY:GeneralFrame:NETEX_COMMUN-1_20170214090012:LOC" version="any"> + <netex:TypeOfFrameRef ref="NETEX_COMMUN"/> + <netex:members> + + <netex:Notice id="CITYWAY:Notice:1:LOC" version="any"> + <netex:Text>Notice 1</netex:Text> + <netex:PublicCode>1</netex:PublicCode> + <netex:TypeOfNoticeRef ref="ServiceJourneyNotice"/> + </netex:Notice> + <netex:Notice id="CITYWAY:Notice:2:LOC" version="any"> + <netex:Text>Notice 2</netex:Text> + <netex:PublicCode>2</netex:PublicCode> + <netex:TypeOfNoticeRef ref="ServiceJourneyNotice"/> + </netex:Notice> + <netex:Notice id="CITYWAY:Notice:3:LOC" version="any"> + <netex:Text>Notice 3</netex:Text> + <netex:PublicCode>3</netex:PublicCode> + <netex:TypeOfNoticeRef ref="ServiceJourneyNotice"/> + </netex:Notice> + + </netex:members> + </netex:GeneralFrame> + </netex:dataObjects> +</netex:PublicationDelivery> diff --git a/spec/fixtures/source_OFFRE_TRANSDEV_20170301122519/offre_C00108_9.xml b/spec/fixtures/source_OFFRE_TRANSDEV_20170301122519/offre_C00108_9.xml new file mode 100644 index 000000000..9eefeeb43 --- /dev/null +++ b/spec/fixtures/source_OFFRE_TRANSDEV_20170301122519/offre_C00108_9.xml @@ -0,0 +1,172 @@ +<?xml version="1.0" encoding="UTF-8"?> +<netex:PublicationDelivery xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.netex.org.uk/netex ../../xsd/NeTEx_publication.xsd" xmlns:netex="http://www.netex.org.uk/netex" + xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ifopt="http://www.ifopt.org.uk/ifopt" + xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:core="http://www.govtalk.gov.uk/core" + xmlns:siri="http://www.siri.org.uk/siri" version="1.0"> + <netex:PublicationTimestamp>2017-02-14T09:13:51.0</netex:PublicationTimestamp> + <netex:ParticipantRef>CITYWAY</netex:ParticipantRef> + <netex:dataObjects> + <netex:CompositeFrame id="CITYWAY:CompositeFrame:NETEX_OFFRE_LIGNE-1:LOC" version="any"> + <netex:Name>Ligne 1</netex:Name> + <netex:TypeOfFrameRef ref="NETEX_OFFRE_LIGNE"/> + <netex:frames> + <netex:GeneralFrame id="CITYWAY:GeneralFrame:NETEX_STRUCTURE-20170214090012:LOC" version="any"> + <netex:TypeOfFrameRef ref="NETEX_STRUCTURE"/> + <netex:members> + + <netex:Route id="CITYWAY:Route:1:LOC" version="any"> + <netex:Name>route 1</netex:Name> + <netex:LineRef ref="STIF:CODIFLIGNE:Line:C00108">version="any"</netex:LineRef> + <netex:DirectionType>outbound</netex:DirectionType> + <netex:DirectionRef ref="CITYWAY:Direction:1:LOC" version="any"/> + <netex:InverseRouteRef ref="CITYWAY:Route:2:LOC" version="any"/> + </netex:Route> + <netex:Route id="CITYWAY:Route:2:LOC" version="any"> + <netex:Name>route 2</netex:Name> + <netex:LineRef ref="STIF:CODIFLIGNE:Line:C00108">version="any"</netex:LineRef> + <netex:DirectionType>inbound</netex:DirectionType> + <netex:DirectionRef ref="CITYWAY:Direction:2:LOC" version="any"/> + <netex:InverseRouteRef ref="CITYWAY:Route:1:LOC" version="any"/> + </netex:Route> + + + <netex:Direction id="CITYWAY:Direction:1:LOC" version="any"> + <netex:Name>Par ici</netex:Name> + </netex:Direction> + <netex:Direction id="CITYWAY:Direction:2:LOC" version="any"> + <netex:Name>Par là </netex:Name> + </netex:Direction> + + + <netex:ServiceJourneyPattern id="CITYWAY:ServiceJourneyPattern:1:LOC" version="any"> + <netex:Name>Par ici</netex:Name> + <netex:RouteRef ref="CITYWAY:Route:1:LOC" version="any"/> + <netex:DestinationDisplayRef ref="CITYWAY:DestinationDisplay:1:LOC" version="any"/> + <netex:pointsInSequence> + <netex:StopPointInJourneyPattern id="CITYWAY:StopPointInJourneyPattern:1-1-1:LOC" order="1" + version="any"> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:1-1:LOC" version="any"/> + <netex:ForAlighting>true</netex:ForAlighting> + <netex:ForBoarding>true</netex:ForBoarding> + </netex:StopPointInJourneyPattern> + <netex:StopPointInJourneyPattern id="CITYWAY:StopPointInJourneyPattern:1-1-2:LOC" order="2" + version="any"> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:1-2:LOC" version="any"/> + <netex:ForAlighting>true</netex:ForAlighting> + <netex:ForBoarding>true</netex:ForBoarding> + </netex:StopPointInJourneyPattern> + </netex:pointsInSequence> + <netex:ServiceJourneyPatternType>passenger</netex:ServiceJourneyPatternType> + </netex:ServiceJourneyPattern> + <netex:ServiceJourneyPattern id="CITYWAY:ServiceJourneyPattern:2:LOC" version="any"> + <netex:Name>Par là </netex:Name> + <netex:RouteRef ref="CITYWAY:Route:2:LOC" version="any"/> + <netex:DestinationDisplayRef ref="CITYWAY:DestinationDisplay:2:LOC" version="any"/> + <netex:pointsInSequence> + <netex:StopPointInJourneyPattern id="CITYWAY:StopPointInJourneyPattern:2-2-1:LOC" order="1" + version="any"> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:2-1:LOC" version="any"/> + <netex:ForAlighting>true</netex:ForAlighting> + <netex:ForBoarding>true</netex:ForBoarding> + </netex:StopPointInJourneyPattern> + <netex:StopPointInJourneyPattern id="CITYWAY:StopPointInJourneyPattern:2-2-2:LOC" order="2" + version="any"> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:2-2:LOC" version="any"/> + <netex:ForAlighting>true</netex:ForAlighting> + <netex:ForBoarding>true</netex:ForBoarding> + </netex:StopPointInJourneyPattern> + </netex:pointsInSequence> + <netex:ServiceJourneyPatternType>passenger</netex:ServiceJourneyPatternType> + </netex:ServiceJourneyPattern> + + + <netex:DestinationDisplay id="CITYWAY:DestinationDisplay:1:LOC" version="any"> + <netex:FrontText>Mission 1</netex:FrontText> + <netex:PublicCode>1234</netex:PublicCode> + </netex:DestinationDisplay> + <netex:DestinationDisplay id="CITYWAY:DestinationDisplay:2:LOC" version="any"> + <netex:FrontText>Mission 2</netex:FrontText> + <netex:PublicCode>2345</netex:PublicCode> + </netex:DestinationDisplay> + + + <netex:ScheduledStopPoint id="CITYWAY:ScheduledStopPoint:1-1:LOC" version="any"/> + <netex:ScheduledStopPoint id="CITYWAY:ScheduledStopPoint:1-2:LOC" version="any"/> + <netex:ScheduledStopPoint id="CITYWAY:ScheduledStopPoint:2-1:LOC" version="any"/> + <netex:ScheduledStopPoint id="CITYWAY:ScheduledStopPoint:2-2:LOC" version="any"/> + + + <netex:PassengerStopAssignment id="CITYWAY:PassengerStopAssignment:1-1:LOC" version="any" order="0"> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:1-1:LOC" version="any"/> + <netex:QuayRef ref="FR:78217:ZDE:50094817:STIF">version="any"</netex:QuayRef> + </netex:PassengerStopAssignment> + <netex:PassengerStopAssignment id="CITYWAY:PassengerStopAssignment:2-1:LOC" version="any" order="0"> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:2-1:LOC" version="any"/> + <netex:QuayRef ref="FR:78217:ZDE:50009052:STIF">version="any"</netex:QuayRef> + </netex:PassengerStopAssignment> + <netex:PassengerStopAssignment id="CITYWAY:PassengerStopAssignment:1-2:LOC" version="any" order="0"> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:1-2:LOC" version="any"/> + <netex:QuayRef ref="FR:78217:ZDE:50009053:STIF">version="any"</netex:QuayRef> + </netex:PassengerStopAssignment> + <netex:PassengerStopAssignment id="CITYWAY:PassengerStopAssignment:2-2:LOC" version="any" order="0"> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:2-2:LOC" version="any"/> + <netex:QuayRef ref="FR:78217:ZDE:50094816:STIF">version="any"</netex:QuayRef> + </netex:PassengerStopAssignment> + + + <netex:RoutingConstraintZone id="CITYWAY:RoutingConstraintZone:1:LOC" version="any"> + <netex:Name>ITL 1</netex:Name> + <netex:members> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:1-1:LOC" version="any"/> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:1-2:LOC" version="any"/> + </netex:members> + <netex:ZoneUse>cannotBoardAndAlightInSameZone</netex:ZoneUse> + </netex:RoutingConstraintZone> + + </netex:members> + </netex:GeneralFrame> + <netex:GeneralFrame id="CITYWAY:GeneralFrame:NETEX_HORAIRE-20170214090012:LOC" version="any"> + <netex:TypeOfFrameRef ref="NETEX_HORAIRE"/> + <netex:members> + + <netex:ServiceJourney id="CITYWAY:ServiceJourney:1-1:LOC" version="any"> + <netex:Name>Course 1 par ici</netex:Name> + <netex:noticeAssignments> + <netex:NoticeAssignment id="ns1" version="any" order="0"> + <netex:NoticeRef ref="CITYWAY:Notice:1:LOC"> + version="any"</netex:NoticeRef> + </netex:NoticeAssignment> + </netex:noticeAssignments> + <netex:dayTypes> + <netex:DayTypeRef ref="CITYWAY:DayType:1:LOC"> version="any"</netex:DayTypeRef> + </netex:dayTypes> + + <netex:JourneyPatternRef ref="CITYWAY:ServiceJourneyPattern:1:LOC" version="any"/> + <netex:OperatorRef ref="STIF:CODIFLIGNE:Operator:011"> + version="any"</netex:OperatorRef> + <netex:trainNumbers> + <netex:TrainNumberRef ref="CITYWAY:TrainNumber:1234:LOC">version="any"</netex:TrainNumberRef> + </netex:trainNumbers> + <netex:passingTimes> + <netex:TimetabledPassingTime version="any"> + <netex:ArrivalTime>01:01:00.000</netex:ArrivalTime> + <netex:ArrivalDayOffset>0</netex:ArrivalDayOffset> + <netex:DepartureTime>01:01:00.000</netex:DepartureTime> + <netex:DepartureDayOffset>0</netex:DepartureDayOffset> + </netex:TimetabledPassingTime> + <netex:TimetabledPassingTime version="any"> + <netex:ArrivalTime>01:05:00.000</netex:ArrivalTime> + <netex:ArrivalDayOffset>0</netex:ArrivalDayOffset> + <netex:DepartureTime>01:05:00.000</netex:DepartureTime> + <netex:DepartureDayOffset>0</netex:DepartureDayOffset> + </netex:TimetabledPassingTime> + </netex:passingTimes> + </netex:ServiceJourney> + + </netex:members> + </netex:GeneralFrame> + </netex:frames> + </netex:CompositeFrame> + </netex:dataObjects> +</netex:PublicationDelivery> diff --git a/spec/fixtures/source_OFFRE_TRANSDEV_20170301122519/offre_C00109_10.xml b/spec/fixtures/source_OFFRE_TRANSDEV_20170301122519/offre_C00109_10.xml new file mode 100644 index 000000000..d260ef17e --- /dev/null +++ b/spec/fixtures/source_OFFRE_TRANSDEV_20170301122519/offre_C00109_10.xml @@ -0,0 +1,172 @@ +<?xml version="1.0" encoding="UTF-8"?> +<netex:PublicationDelivery xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.netex.org.uk/netex ../../xsd/NeTEx_publication.xsd" xmlns:netex="http://www.netex.org.uk/netex" + xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ifopt="http://www.ifopt.org.uk/ifopt" + xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:core="http://www.govtalk.gov.uk/core" + xmlns:siri="http://www.siri.org.uk/siri" version="1.0"> + <netex:PublicationTimestamp>2017-02-14T09:13:51.0</netex:PublicationTimestamp> + <netex:ParticipantRef>CITYWAY</netex:ParticipantRef> + <netex:dataObjects> + <netex:CompositeFrame id="CITYWAY:CompositeFrame:NETEX_OFFRE_LIGNE-1:LOC" version="any"> + <netex:Name>Ligne 1</netex:Name> + <netex:TypeOfFrameRef ref="NETEX_OFFRE_LIGNE"/> + <netex:frames> + <netex:GeneralFrame id="CITYWAY:GeneralFrame:NETEX_STRUCTURE-20170214090012:LOC" version="any"> + <netex:TypeOfFrameRef ref="NETEX_STRUCTURE"/> + <netex:members> + + <netex:Route id="CITYWAY:Route:1:LOC" version="any"> + <netex:Name>route 1</netex:Name> + <netex:LineRef ref="STIF:CODIFLIGNE:Line:C00109">version="any"</netex:LineRef> + <netex:DirectionType>outbound</netex:DirectionType> + <netex:DirectionRef ref="CITYWAY:Direction:1:LOC" version="any"/> + <netex:InverseRouteRef ref="CITYWAY:Route:2:LOC" version="any"/> + </netex:Route> + <netex:Route id="CITYWAY:Route:2:LOC" version="any"> + <netex:Name>route 2</netex:Name> + <netex:LineRef ref="STIF:CODIFLIGNE:Line:C00109">version="any"</netex:LineRef> + <netex:DirectionType>inbound</netex:DirectionType> + <netex:DirectionRef ref="CITYWAY:Direction:2:LOC" version="any"/> + <netex:InverseRouteRef ref="CITYWAY:Route:1:LOC" version="any"/> + </netex:Route> + + + <netex:Direction id="CITYWAY:Direction:1:LOC" version="any"> + <netex:Name>Par ici aussi</netex:Name> + </netex:Direction> + <netex:Direction id="CITYWAY:Direction:2:LOC" version="any"> + <netex:Name>Par là aussi</netex:Name> + </netex:Direction> + + + <netex:ServiceJourneyPattern id="CITYWAY:ServiceJourneyPattern:1:LOC" version="any"> + <netex:Name>Par ici itou</netex:Name> + <netex:RouteRef ref="CITYWAY:Route:1:LOC" version="any"/> + <netex:DestinationDisplayRef ref="CITYWAY:DestinationDisplay:1:LOC" version="any"/> + <netex:pointsInSequence> + <netex:StopPointInJourneyPattern id="CITYWAY:StopPointInJourneyPattern:1-1-1:LOC" order="1" + version="any"> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:1-1:LOC" version="any"/> + <netex:ForAlighting>true</netex:ForAlighting> + <netex:ForBoarding>true</netex:ForBoarding> + </netex:StopPointInJourneyPattern> + <netex:StopPointInJourneyPattern id="CITYWAY:StopPointInJourneyPattern:1-1-2:LOC" order="2" + version="any"> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:1-2:LOC" version="any"/> + <netex:ForAlighting>true</netex:ForAlighting> + <netex:ForBoarding>true</netex:ForBoarding> + </netex:StopPointInJourneyPattern> + </netex:pointsInSequence> + <netex:ServiceJourneyPatternType>passenger</netex:ServiceJourneyPatternType> + </netex:ServiceJourneyPattern> + <netex:ServiceJourneyPattern id="CITYWAY:ServiceJourneyPattern:2:LOC" version="any"> + <netex:Name>Par là itou</netex:Name> + <netex:RouteRef ref="CITYWAY:Route:2:LOC" version="any"/> + <netex:DestinationDisplayRef ref="CITYWAY:DestinationDisplay:2:LOC" version="any"/> + <netex:pointsInSequence> + <netex:StopPointInJourneyPattern id="CITYWAY:StopPointInJourneyPattern:2-2-1:LOC" order="1" + version="any"> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:2-1:LOC" version="any"/> + <netex:ForAlighting>true</netex:ForAlighting> + <netex:ForBoarding>true</netex:ForBoarding> + </netex:StopPointInJourneyPattern> + <netex:StopPointInJourneyPattern id="CITYWAY:StopPointInJourneyPattern:2-2-2:LOC" order="2" + version="any"> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:2-2:LOC" version="any"/> + <netex:ForAlighting>true</netex:ForAlighting> + <netex:ForBoarding>true</netex:ForBoarding> + </netex:StopPointInJourneyPattern> + </netex:pointsInSequence> + <netex:ServiceJourneyPatternType>passenger</netex:ServiceJourneyPatternType> + </netex:ServiceJourneyPattern> + + + <netex:DestinationDisplay id="CITYWAY:DestinationDisplay:1:LOC" version="any"> + <netex:FrontText>Mission 1 bis</netex:FrontText> + <netex:PublicCode>1234</netex:PublicCode> + </netex:DestinationDisplay> + <netex:DestinationDisplay id="CITYWAY:DestinationDisplay:2:LOC" version="any"> + <netex:FrontText>Mission 2 bis</netex:FrontText> + <netex:PublicCode>2345</netex:PublicCode> + </netex:DestinationDisplay> + + + <netex:ScheduledStopPoint id="CITYWAY:ScheduledStopPoint:1-1:LOC" version="any"/> + <netex:ScheduledStopPoint id="CITYWAY:ScheduledStopPoint:1-2:LOC" version="any"/> + <netex:ScheduledStopPoint id="CITYWAY:ScheduledStopPoint:2-1:LOC" version="any"/> + <netex:ScheduledStopPoint id="CITYWAY:ScheduledStopPoint:2-2:LOC" version="any"/> + + + <netex:PassengerStopAssignment id="CITYWAY:PassengerStopAssignment:1-1:LOC" version="any" order="0"> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:1-1:LOC" version="any"/> + <netex:QuayRef ref="FR:78217:ZDE:50094817:STIF">version="any"</netex:QuayRef> + </netex:PassengerStopAssignment> + <netex:PassengerStopAssignment id="CITYWAY:PassengerStopAssignment:2-1:LOC" version="any" order="0"> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:2-1:LOC" version="any"/> + <netex:QuayRef ref="FR:78402:ZDE:50000918:STIF">version="any"</netex:QuayRef> + </netex:PassengerStopAssignment> + <netex:PassengerStopAssignment id="CITYWAY:PassengerStopAssignment:1-2:LOC" version="any" order="0"> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:1-2:LOC" version="any"/> + <netex:QuayRef ref="FR:78402:ZDE:50000917:STIF">version="any"</netex:QuayRef> + </netex:PassengerStopAssignment> + <netex:PassengerStopAssignment id="CITYWAY:PassengerStopAssignment:2-2:LOC" version="any" order="0"> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:2-2:LOC" version="any"/> + <netex:QuayRef ref="FR:78217:ZDE:50094816:STIF">version="any"</netex:QuayRef> + </netex:PassengerStopAssignment> + + + <netex:RoutingConstraintZone id="CITYWAY:RoutingConstraintZone:1:LOC" version="any"> + <netex:Name>ITL 1</netex:Name> + <netex:members> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:1-1:LOC" version="any"/> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:1-2:LOC" version="any"/> + </netex:members> + <netex:ZoneUse>cannotBoardAndAlightInSameZone</netex:ZoneUse> + </netex:RoutingConstraintZone> + + </netex:members> + </netex:GeneralFrame> + <netex:GeneralFrame id="CITYWAY:GeneralFrame:NETEX_HORAIRE-20170214090012:LOC" version="any"> + <netex:TypeOfFrameRef ref="NETEX_HORAIRE"/> + <netex:members> + + <netex:ServiceJourney id="CITYWAY:ServiceJourney:1-1:LOC" version="any"> + <netex:Name>Course 1 par ici aussi</netex:Name> + <netex:noticeAssignments> + <netex:NoticeAssignment id="ns1" version="any" order="0"> + <netex:NoticeRef ref="CITYWAY:Notice:2:LOC"> + version="any"</netex:NoticeRef> + </netex:NoticeAssignment> + </netex:noticeAssignments> + <netex:dayTypes> + <netex:DayTypeRef ref="CITYWAY:DayType:1:LOC"> version="any"</netex:DayTypeRef> + <netex:DayTypeRef ref="CITYWAY:DayType:4:LOC"> version="any"</netex:DayTypeRef> + </netex:dayTypes> + <netex:JourneyPatternRef ref="CITYWAY:ServiceJourneyPattern:1:LOC" version="any"/> + <netex:OperatorRef ref="STIF:CODIFLIGNE:Operator:212"> + version="any"</netex:OperatorRef> + <netex:trainNumbers> + <netex:TrainNumberRef ref="CITYWAY:TrainNumber:1234:LOC">version="any"</netex:TrainNumberRef> + </netex:trainNumbers> + <netex:passingTimes> + <netex:TimetabledPassingTime version="any"> + <netex:ArrivalTime>23:58:00.000</netex:ArrivalTime> + <netex:ArrivalDayOffset>0</netex:ArrivalDayOffset> + <netex:DepartureTime>23:59:00.000</netex:DepartureTime> + <netex:DepartureDayOffset>0</netex:DepartureDayOffset> + </netex:TimetabledPassingTime> + <netex:TimetabledPassingTime version="any"> + <netex:ArrivalTime>00:03:00.000</netex:ArrivalTime> + <netex:ArrivalDayOffset>1</netex:ArrivalDayOffset> + <netex:DepartureTime>00:04:00.000</netex:DepartureTime> + <netex:DepartureDayOffset>1</netex:DepartureDayOffset> + </netex:TimetabledPassingTime> + </netex:passingTimes> + </netex:ServiceJourney> + + </netex:members> + </netex:GeneralFrame> + </netex:frames> + </netex:CompositeFrame> + </netex:dataObjects> +</netex:PublicationDelivery> diff --git a/spec/fixtures/target/OFFRE_TRANSDEV_20170301122517/calendriers.xml b/spec/fixtures/target/OFFRE_TRANSDEV_20170301122517/calendriers.xml new file mode 100644 index 000000000..bfbd0aea1 --- /dev/null +++ b/spec/fixtures/target/OFFRE_TRANSDEV_20170301122517/calendriers.xml @@ -0,0 +1,86 @@ +<?xml version="1.0" encoding="UTF-8"?> +<netex:PublicationDelivery xmlns:netex="http://www.netex.org.uk/netex" + xmlns:siri="http://www.siri.org.uk/siri" xmlns:core="http://www.govtalk.gov.uk/core" + xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:ifopt="http://www.ifopt.org.uk/ifopt" + xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + version="1.0"> + <netex:PublicationTimestamp>2017-02-14T09:13:51.0</netex:PublicationTimestamp> + <netex:ParticipantRef>CITYWAY</netex:ParticipantRef> + <netex:dataObjects> + <netex:GeneralFrame id="CITYWAY:GeneralFrame:NETEX_CALENDRIER-1_20170214090012:LOC" + version="any"> + <netex:TypeOfFrameRef ref="NETEX_CALENDRIER"/> + <netex:ValidBetween> + <netex:FromDate>2017-03-01</netex:FromDate> + <netex:ToDate>2017-03-31</netex:ToDate> + </netex:ValidBetween> + <netex:members> + <netex:dayTypes> + <netex:DayType id="CITYWAY:DayType:1:LOC" version="any" > + <netex:Name>Semaine</netex:Name> + <netex:properties> + <netex:PropertyOfDay> + <netex:DaysOfWeek>Monday</netex:DaysOfWeek> + </netex:PropertyOfDay> + <netex:PropertyOfDay> + <netex:DaysOfWeek>Tuesday</netex:DaysOfWeek> + </netex:PropertyOfDay> + <netex:PropertyOfDay> + <netex:DaysOfWeek>Wednesday</netex:DaysOfWeek> + </netex:PropertyOfDay> + <netex:PropertyOfDay> + <netex:DaysOfWeek>Thursday</netex:DaysOfWeek> + </netex:PropertyOfDay> + <netex:PropertyOfDay> + <netex:DaysOfWeek>Friday</netex:DaysOfWeek> + </netex:PropertyOfDay> + </netex:properties> + </netex:DayType> + <netex:DayType id="CITYWAY:DayType:2:LOC" version="any" > + <netex:Name>Fin de semaine</netex:Name> + <netex:properties> + <netex:PropertyOfDay> + <netex:DaysOfWeek>Saturday</netex:DaysOfWeek> + </netex:PropertyOfDay> + <netex:PropertyOfDay> + <netex:DaysOfWeek>Sunday</netex:DaysOfWeek> + </netex:PropertyOfDay> + </netex:properties> + </netex:DayType> + <netex:DayType id="CITYWAY:DayType:3:LOC" version="any" > + <netex:Name>Service spécial</netex:Name> + </netex:DayType> + <netex:DayType id="CITYWAY:DayType:4:LOC" version="any" > + <netex:Name>Restriction</netex:Name> + </netex:DayType> + </netex:dayTypes> + <netex:dayTypeAssignments> + <netex:DayTypeAssignment version="any" > + <netex:OperatingPeriodRef ref="CITYWAY:OperatingPeriod:1:LOC" version="any"/> + <netex:DayTypeRef ref="CITYWAY:DayType:1:LOC" version="any"/> + </netex:DayTypeAssignment> + <netex:DayTypeAssignment version="any" > + <netex:OperatingPeriodRef ref="CITYWAY:OperatingPeriod:1:LOC" version="any"/> + <netex:DayTypeRef ref="CITYWAY:DayType:2:LOC" version="any"/> + </netex:DayTypeAssignment> + <netex:DayTypeAssignment version="any" > + <netex:Date>2017-03-15</netex:Date> + <netex:DayTypeRef ref="CITYWAY:DayType:3:LOC" version="any"/> + <netex:isAvailable>true</netex:isAvailable> + </netex:DayTypeAssignment> + <netex:DayTypeAssignment version="any" > + <netex:Date>2017-03-15</netex:Date> + <netex:DayTypeRef ref="CITYWAY:DayType:4:LOC" version="any"/> + <netex:isAvailable>false</netex:isAvailable> + </netex:DayTypeAssignment> + </netex:dayTypeAssignments> + <netex:operatingPeriods> + <netex:OperatingPeriod id="CITYWAY:OperatingPeriod:1:LOC" version="any" > + <netex:FromDate>2017-01-01</netex:FromDate> + <netex:ToDate>2017-12-31</netex:ToDate> + </netex:OperatingPeriod> + </netex:operatingPeriods> + </netex:members> + </netex:GeneralFrame> + </netex:dataObjects> +</netex:PublicationDelivery> diff --git a/spec/fixtures/target/OFFRE_TRANSDEV_20170301122517/commun.xml b/spec/fixtures/target/OFFRE_TRANSDEV_20170301122517/commun.xml new file mode 100644 index 000000000..266c8a598 --- /dev/null +++ b/spec/fixtures/target/OFFRE_TRANSDEV_20170301122517/commun.xml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?> +<netex:PublicationDelivery xmlns:netex="http://www.netex.org.uk/netex" + xmlns:siri="http://www.siri.org.uk/siri" xmlns:core="http://www.govtalk.gov.uk/core" + xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:ifopt="http://www.ifopt.org.uk/ifopt" + xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + version="1.0"> + <netex:PublicationTimestamp>2017-02-14T09:13:51.0</netex:PublicationTimestamp> + <netex:ParticipantRef>CITYWAY</netex:ParticipantRef> + <netex:dataObjects> + <netex:GeneralFrame id="CITYWAY:GeneralFrame:NETEX_COMMUN-1_20170214090012:LOC" version="any"> + <netex:TypeOfFrameRef ref="NETEX_COMMUN"/> + <netex:members> + <netex:notices> + <netex:Notice id="CITYWAY:Notice:1:LOC" version="any"> + <netex:Text>Notice 1</netex:Text> + <netex:PublicCode>1</netex:PublicCode> + <netex:TypeOfNoticeRef>ServiceJourneyNotice</netex:TypeOfNoticeRef> + </netex:Notice> + <netex:Notice id="CITYWAY:Notice:2:LOC" version="any"> + <netex:Text>Notice 2</netex:Text> + <netex:PublicCode>2</netex:PublicCode> + <netex:TypeOfNoticeRef>ServiceJourneyNotice</netex:TypeOfNoticeRef> + </netex:Notice> + <netex:Notice id="CITYWAY:Notice:3:LOC" version="any"> + <netex:Text>Notice 3</netex:Text> + <netex:PublicCode>3</netex:PublicCode> + <netex:TypeOfNoticeRef>ServiceJourneyNotice</netex:TypeOfNoticeRef> + </netex:Notice> + </netex:notices> + </netex:members> + </netex:GeneralFrame> + </netex:dataObjects> +</netex:PublicationDelivery> diff --git a/spec/fixtures/target/OFFRE_TRANSDEV_20170301122517/offre_C00108_9.xml b/spec/fixtures/target/OFFRE_TRANSDEV_20170301122517/offre_C00108_9.xml new file mode 100644 index 000000000..832793036 --- /dev/null +++ b/spec/fixtures/target/OFFRE_TRANSDEV_20170301122517/offre_C00108_9.xml @@ -0,0 +1,202 @@ +<?xml version="1.0" encoding="UTF-8"?> +<netex:PublicationDelivery xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.netex.org.uk/netex ../../xsd/NeTEx_publication.xsd" + xmlns:netex="http://www.netex.org.uk/netex" xmlns:xlink="http://www.w3.org/1999/xlink" + xmlns:ifopt="http://www.ifopt.org.uk/ifopt" xmlns:gml="http://www.opengis.net/gml/3.2" + xmlns:core="http://www.govtalk.gov.uk/core" xmlns:siri="http://www.siri.org.uk/siri" version="1.0"> + <netex:PublicationTimestamp>2017-02-14T09:13:51.0</netex:PublicationTimestamp> + <netex:ParticipantRef>CITYWAY</netex:ParticipantRef> + <netex:dataObjects> + <netex:CompositeFrame id="CITYWAY:CompositeFrame:NETEX_OFFRE_LIGNE-1:LOC" version="any"> + <netex:Name>Ligne 1</netex:Name> + <netex:TypeOfFrameRef ref="NETEX_OFFRE_LIGNE"/> + <netex:frames> + <netex:GeneralFrame id="CITYWAY:GeneralFrame:NETEX_STRUCTURE-20170214090012:LOC" + version="any"> + <netex:TypeOfFrameRef ref="NETEX_STRUCTURE"/> + <netex:members> + <netex:routes> + <netex:Route id="CITYWAY:Route:1:LOC" version="any"> + <netex:Name>route 1</netex:Name> + <netex:LineRef ref="STIF:CODIFLIGNE:Line:C00108">version="any"</netex:LineRef> + <netex:DirectionType>outbound</netex:DirectionType> + <netex:DirectionRef ref="CITYWAY:Direction:1:LOC" version="any"/> + <netex:InverseRouteRef ref="CITYWAY:Route:2:LOC" version="any"/> + </netex:Route> + <netex:Route id="CITYWAY:Route:2:LOC" version="any"> + <netex:Name>route 2</netex:Name> + <netex:LineRef ref="STIF:CODIFLIGNE:Line:C00108">version="any"</netex:LineRef> + <netex:DirectionType>inbound</netex:DirectionType> + <netex:DirectionRef ref="CITYWAY:Direction:2:LOC" version="any"/> + <netex:InverseRouteRef ref="CITYWAY:Route:1:LOC" version="any"/> + </netex:Route> + </netex:routes> + <netex:directions> + <netex:Direction id="CITYWAY:Direction:1:LOC" version="any"> + <netex:Name>Par ici</netex:Name> + </netex:Direction> + <netex:Direction id="CITYWAY:Direction:2:LOC" version="any"> + <netex:Name>Par là </netex:Name> + </netex:Direction> + </netex:directions> + <netex:serviceJourneyPatterns> + <netex:ServiceJourneyPattern id="CITYWAY:ServiceJourneyPattern:1:LOC" + version="any"> + <netex:Name>Par ici</netex:Name> + <netex:RouteRef ref="CITYWAY:Route:1:LOC" version="any"/> + <netex:DestinationDisplayRef ref="CITYWAY:DestinationDisplay:1:LOC" + version="any"/> + <netex:pointsInSequence> + <netex:StopPointInJourneyPattern + id="CITYWAY:StopPointInJourneyPattern:1-1-1:LOC" order="1" + version="any"> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:1-1:LOC" version="any"/> + <netex:ForAlighting>true</netex:ForAlighting> + <netex:ForBoarding>true</netex:ForBoarding> + </netex:StopPointInJourneyPattern> + <netex:StopPointInJourneyPattern + id="CITYWAY:StopPointInJourneyPattern:1-1-2:LOC" order="2" + version="any"> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:1-2:LOC" version="any"/> + <netex:ForAlighting>true</netex:ForAlighting> + <netex:ForBoarding>true</netex:ForBoarding> + </netex:StopPointInJourneyPattern> + </netex:pointsInSequence> + <netex:ServiceJourneyPatternType>passenger</netex:ServiceJourneyPatternType> + </netex:ServiceJourneyPattern> + <netex:ServiceJourneyPattern id="CITYWAY:ServiceJourneyPattern:2:LOC" + version="any"> + <netex:Name>Par là </netex:Name> + <netex:RouteRef ref="CITYWAY:Route:2:LOC" version="any"/> + <netex:DestinationDisplayRef ref="CITYWAY:DestinationDisplay:2:LOC" + version="any"/> + <netex:pointsInSequence> + <netex:StopPointInJourneyPattern + id="CITYWAY:StopPointInJourneyPattern:2-2-1:LOC" order="1" + version="any"> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:2-1:LOC" version="any"/> + <netex:ForAlighting>true</netex:ForAlighting> + <netex:ForBoarding>true</netex:ForBoarding> + </netex:StopPointInJourneyPattern> + <netex:StopPointInJourneyPattern + id="CITYWAY:StopPointInJourneyPattern:2-2-2:LOC" order="2" + version="any"> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:2-2:LOC" version="any"/> + <netex:ForAlighting>true</netex:ForAlighting> + <netex:ForBoarding>true</netex:ForBoarding> + </netex:StopPointInJourneyPattern> + </netex:pointsInSequence> + <netex:ServiceJourneyPatternType>passenger</netex:ServiceJourneyPatternType> + </netex:ServiceJourneyPattern> + </netex:serviceJourneyPatterns> + <netex:destinationDisplays> + <netex:DestinationDisplay id="CITYWAY:DestinationDisplay:1:LOC" + version="any"> + <netex:FrontText>Mission 1</netex:FrontText> + <netex:PublicCode>1234</netex:PublicCode> + </netex:DestinationDisplay> + <netex:DestinationDisplay id="CITYWAY:DestinationDisplay:2:LOC" + version="any"> + <netex:FrontText>Mission 2</netex:FrontText> + <netex:PublicCode>2345</netex:PublicCode> + </netex:DestinationDisplay> + </netex:destinationDisplays> + <netex:scheduledStopPoints> + <netex:ScheduledStopPoint id="CITYWAY:ScheduledStopPoint:1-1:LOC" + version="any"/> + <netex:ScheduledStopPoint id="CITYWAY:ScheduledStopPoint:1-2:LOC" + version="any"/> + <netex:ScheduledStopPoint id="CITYWAY:ScheduledStopPoint:2-1:LOC" + version="any"/> + <netex:ScheduledStopPoint id="CITYWAY:ScheduledStopPoint:2-2:LOC" + version="any"/> + </netex:scheduledStopPoints> + <netex:passengerStopAssignments> + <netex:PassengerStopAssignment + id="CITYWAY:PassengerStopAssignment:1-1:LOC" version="any"> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:1-1:LOC" version="any"/> + <netex:QuayRef ref="FR:78217:ZDE:50094817:STIF">version="any"</netex:QuayRef> + </netex:PassengerStopAssignment> + <netex:PassengerStopAssignment + id="CITYWAY:PassengerStopAssignment:2-1:LOC" version="any"> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:2-1:LOC" version="any"/> + <netex:QuayRef ref="FR:78217:ZDE:50009052:STIF">version="any"</netex:QuayRef> + </netex:PassengerStopAssignment> + <netex:PassengerStopAssignment + id="CITYWAY:PassengerStopAssignment:1-2:LOC" version="any"> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:1-2:LOC" version="any"/> + <netex:QuayRef ref="FR:78217:ZDE:50009053:STIF">version="any"</netex:QuayRef> + </netex:PassengerStopAssignment> + <netex:PassengerStopAssignment + id="CITYWAY:PassengerStopAssignment:2-2:LOC" version="any"> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:2-2:LOC" version="any"/> + <netex:QuayRef ref="FR:78217:ZDE:50094816:STIF">version="any"</netex:QuayRef> + </netex:PassengerStopAssignment> + </netex:passengerStopAssignments> + <netex:routingConstraintZones> + <netex:RoutingConstraintZone id="CITYWAY:RoutingConstraintZone:1:LOC" + version="any"> + <netex:Name>ITL 1</netex:Name> + <netex:members> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:1-1:LOC" version="any"/> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:2-1:LOC" version="any"/> + </netex:members> + <netex:ZoneUse>cannotBoardAndAlightInSameZone</netex:ZoneUse> + </netex:RoutingConstraintZone> + </netex:routingConstraintZones> + </netex:members> + </netex:GeneralFrame> + <netex:GeneralFrame id="CITYWAY:GeneralFrame:NETEX_HORAIRE-20170214090012:LOC" + version="any"> + <netex:TypeOfFrameRef ref="NETEX_HORAIRE"/> + <netex:members> + <netex:serviceJourneys> + <netex:ServiceJourney id="CITYWAY:ServiceJourney:1-1:LOC" version="any"> + <netex:Name>Course 1 par ici</netex:Name> + <netex:noticeAssignments> + <netex:NoticeAssignment> + <netex:NoticeRef ref="CITYWAY:Notice:1:LOC"> + version="any"</netex:NoticeRef> + </netex:NoticeAssignment> + </netex:noticeAssignments> + <netex:DayTypeRef ref="CITYWAY:DayType:1:LOC"> + version="any"</netex:DayTypeRef> + <netex:JourneyPatternRef ref="CITYWAY:ServiceJourneyPattern:1:LOC" + version="any"/> + <netex:OperatorRef ref="STIF:CODIFLIGNE:Operator:011"> + version="any"</netex:OperatorRef> + <netex:trainNumbers> + <netex:TrainNumberRef ref="CITYWAY:TrainNumber:1234:LOC">version="any"</netex:TrainNumberRef> + </netex:trainNumbers> + <netex:passingTimes> + <netex:TimetabledPassingTime version="any"> + <netex:ArrivalTime>01:01:00.000</netex:ArrivalTime> + <netex:ArrivalDayOffset>0</netex:ArrivalDayOffset> + <netex:DepartureTime>01:01:00.000</netex:DepartureTime> + <netex:DepartureDayOffset>0</netex:DepartureDayOffset> + </netex:TimetabledPassingTime> + <netex:TimetabledPassingTime version="any"> + <netex:ArrivalTime>01:05:00.000</netex:ArrivalTime> + <netex:ArrivalDayOffset>0</netex:ArrivalDayOffset> + <netex:DepartureTime>01:05:00.000</netex:DepartureTime> + <netex:DepartureDayOffset>0</netex:DepartureDayOffset> + </netex:TimetabledPassingTime> + </netex:passingTimes> + </netex:ServiceJourney> + </netex:serviceJourneys> + </netex:members> + </netex:GeneralFrame> + </netex:frames> + </netex:CompositeFrame> + </netex:dataObjects> +</netex:PublicationDelivery> diff --git a/spec/fixtures/target/OFFRE_TRANSDEV_20170301122517/offre_C00109_10.xml b/spec/fixtures/target/OFFRE_TRANSDEV_20170301122517/offre_C00109_10.xml new file mode 100644 index 000000000..9dff0d850 --- /dev/null +++ b/spec/fixtures/target/OFFRE_TRANSDEV_20170301122517/offre_C00109_10.xml @@ -0,0 +1,204 @@ +<?xml version="1.0" encoding="UTF-8"?> +<netex:PublicationDelivery xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.netex.org.uk/netex ../../xsd/NeTEx_publication.xsd" + xmlns:netex="http://www.netex.org.uk/netex" xmlns:xlink="http://www.w3.org/1999/xlink" + xmlns:ifopt="http://www.ifopt.org.uk/ifopt" xmlns:gml="http://www.opengis.net/gml/3.2" + xmlns:core="http://www.govtalk.gov.uk/core" xmlns:siri="http://www.siri.org.uk/siri" version="1.0"> + <netex:PublicationTimestamp>2017-02-14T09:13:51.0</netex:PublicationTimestamp> + <netex:ParticipantRef>CITYWAY</netex:ParticipantRef> + <netex:dataObjects> + <netex:CompositeFrame id="CITYWAY:CompositeFrame:NETEX_OFFRE_LIGNE-1:LOC" version="any"> + <netex:Name>Ligne 1</netex:Name> + <netex:TypeOfFrameRef ref="NETEX_OFFRE_LIGNE"/> + <netex:frames> + <netex:GeneralFrame id="CITYWAY:GeneralFrame:NETEX_STRUCTURE-20170214090012:LOC" + version="any"> + <netex:TypeOfFrameRef ref="NETEX_STRUCTURE"/> + <netex:members> + <netex:routes> + <netex:Route id="CITYWAY:Route:1:LOC" version="any"> + <netex:Name>route 1</netex:Name> + <netex:LineRef ref="STIF:CODIFLIGNE:Line:C00109">version="any"</netex:LineRef> + <netex:DirectionType>outbound</netex:DirectionType> + <netex:DirectionRef ref="CITYWAY:Direction:1:LOC" version="any"/> + <netex:InverseRouteRef ref="CITYWAY:Route:2:LOC" version="any"/> + </netex:Route> + <netex:Route id="CITYWAY:Route:2:LOC" version="any"> + <netex:Name>route 2</netex:Name> + <netex:LineRef ref="STIF:CODIFLIGNE:Line:C00109">version="any"</netex:LineRef> + <netex:DirectionType>inbound</netex:DirectionType> + <netex:DirectionRef ref="CITYWAY:Direction:2:LOC" version="any"/> + <netex:InverseRouteRef ref="CITYWAY:Route:1:LOC" version="any"/> + </netex:Route> + </netex:routes> + <netex:directions> + <netex:Direction id="CITYWAY:Direction:1:LOC" version="any"> + <netex:Name>Par ici aussi</netex:Name> + </netex:Direction> + <netex:Direction id="CITYWAY:Direction:2:LOC" version="any"> + <netex:Name>Par là aussi</netex:Name> + </netex:Direction> + </netex:directions> + <netex:serviceJourneyPatterns> + <netex:ServiceJourneyPattern id="CITYWAY:ServiceJourneyPattern:1:LOC" + version="any"> + <netex:Name>Par ici itou</netex:Name> + <netex:RouteRef ref="CITYWAY:Route:1:LOC" version="any"/> + <netex:DestinationDisplayRef ref="CITYWAY:DestinationDisplay:1:LOC" + version="any"/> + <netex:pointsInSequence> + <netex:StopPointInJourneyPattern + id="CITYWAY:StopPointInJourneyPattern:1-1-1:LOC" order="1" + version="any"> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:1-1:LOC" version="any"/> + <netex:ForAlighting>true</netex:ForAlighting> + <netex:ForBoarding>true</netex:ForBoarding> + </netex:StopPointInJourneyPattern> + <netex:StopPointInJourneyPattern + id="CITYWAY:StopPointInJourneyPattern:1-1-2:LOC" order="2" + version="any"> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:1-2:LOC" version="any"/> + <netex:ForAlighting>true</netex:ForAlighting> + <netex:ForBoarding>true</netex:ForBoarding> + </netex:StopPointInJourneyPattern> + </netex:pointsInSequence> + <netex:ServiceJourneyPatternType>passenger</netex:ServiceJourneyPatternType> + </netex:ServiceJourneyPattern> + <netex:ServiceJourneyPattern id="CITYWAY:ServiceJourneyPattern:2:LOC" + version="any"> + <netex:Name>Par là itou</netex:Name> + <netex:RouteRef ref="CITYWAY:Route:2:LOC" version="any"/> + <netex:DestinationDisplayRef ref="CITYWAY:DestinationDisplay:2:LOC" + version="any"/> + <netex:pointsInSequence> + <netex:StopPointInJourneyPattern + id="CITYWAY:StopPointInJourneyPattern:2-2-1:LOC" order="1" + version="any"> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:2-1:LOC" version="any"/> + <netex:ForAlighting>true</netex:ForAlighting> + <netex:ForBoarding>true</netex:ForBoarding> + </netex:StopPointInJourneyPattern> + <netex:StopPointInJourneyPattern + id="CITYWAY:StopPointInJourneyPattern:2-2-2:LOC" order="2" + version="any"> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:2-2:LOC" version="any"/> + <netex:ForAlighting>true</netex:ForAlighting> + <netex:ForBoarding>true</netex:ForBoarding> + </netex:StopPointInJourneyPattern> + </netex:pointsInSequence> + <netex:ServiceJourneyPatternType>passenger</netex:ServiceJourneyPatternType> + </netex:ServiceJourneyPattern> + </netex:serviceJourneyPatterns> + <netex:destinationDisplays> + <netex:DestinationDisplay id="CITYWAY:DestinationDisplay:1:LOC" + version="any"> + <netex:FrontText>Mission 1 bis</netex:FrontText> + <netex:PublicCode>1234</netex:PublicCode> + </netex:DestinationDisplay> + <netex:DestinationDisplay id="CITYWAY:DestinationDisplay:2:LOC" + version="any"> + <netex:FrontText>Mission 2 bis</netex:FrontText> + <netex:PublicCode>2345</netex:PublicCode> + </netex:DestinationDisplay> + </netex:destinationDisplays> + <netex:scheduledStopPoints> + <netex:ScheduledStopPoint id="CITYWAY:ScheduledStopPoint:1-1:LOC" + version="any"/> + <netex:ScheduledStopPoint id="CITYWAY:ScheduledStopPoint:1-2:LOC" + version="any"/> + <netex:ScheduledStopPoint id="CITYWAY:ScheduledStopPoint:2-1:LOC" + version="any"/> + <netex:ScheduledStopPoint id="CITYWAY:ScheduledStopPoint:2-2:LOC" + version="any"/> + </netex:scheduledStopPoints> + <netex:passengerStopAssignments> + <netex:PassengerStopAssignment + id="CITYWAY:PassengerStopAssignment:1-1:LOC" version="any"> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:1-1:LOC" version="any"/> + <netex:QuayRef ref="FR:78217:ZDE:50094817:STIF">version="any"</netex:QuayRef> + </netex:PassengerStopAssignment> + <netex:PassengerStopAssignment + id="CITYWAY:PassengerStopAssignment:2-1:LOC" version="any"> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:2-1:LOC" version="any"/> + <netex:QuayRef ref="FR:78402:ZDE:50000918:STIF">version="any"</netex:QuayRef> + </netex:PassengerStopAssignment> + <netex:PassengerStopAssignment + id="CITYWAY:PassengerStopAssignment:1-2:LOC" version="any"> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:1-2:LOC" version="any"/> + <netex:QuayRef ref="FR:78402:ZDE:50000917:STIF">version="any"</netex:QuayRef> + </netex:PassengerStopAssignment> + <netex:PassengerStopAssignment + id="CITYWAY:PassengerStopAssignment:2-2:LOC" version="any"> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:2-2:LOC" version="any"/> + <netex:QuayRef ref="FR:78217:ZDE:50094816:STIF">version="any"</netex:QuayRef> + </netex:PassengerStopAssignment> + </netex:passengerStopAssignments> + <netex:routingConstraintZones> + <netex:RoutingConstraintZone id="CITYWAY:RoutingConstraintZone:1:LOC" + version="any"> + <netex:Name>ITL 1</netex:Name> + <netex:members> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:1-1:LOC" version="any"/> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:2-1:LOC" version="any"/> + </netex:members> + <netex:ZoneUse>cannotBoardAndAlightInSameZone</netex:ZoneUse> + </netex:RoutingConstraintZone> + </netex:routingConstraintZones> + </netex:members> + </netex:GeneralFrame> + <netex:GeneralFrame id="CITYWAY:GeneralFrame:NETEX_HORAIRE-20170214090012:LOC" + version="any"> + <netex:TypeOfFrameRef ref="NETEX_HORAIRE"/> + <netex:members> + <netex:serviceJourneys> + <netex:ServiceJourney id="CITYWAY:ServiceJourney:1-1:LOC" version="any"> + <netex:Name>Course 1 par ici aussi</netex:Name> + <netex:noticeAssignments> + <netex:NoticeAssignment> + <netex:NoticeRef ref="CITYWAY:Notice:2:LOC"> + version="any"</netex:NoticeRef> + </netex:NoticeAssignment> + </netex:noticeAssignments> + <netex:DayTypeRef ref="CITYWAY:DayType:1:LOC"> + version="any"</netex:DayTypeRef> + <netex:DayTypeRef ref="CITYWAY:DayType:4:LOC"> + version="any"</netex:DayTypeRef> + <netex:JourneyPatternRef ref="CITYWAY:ServiceJourneyPattern:1:LOC" + version="any"/> + <netex:OperatorRef ref="STIF:CODIFLIGNE:Operator:212"> + version="any"</netex:OperatorRef> + <netex:trainNumbers> + <netex:TrainNumberRef ref="CITYWAY:TrainNumber:1234:LOC">version="any"</netex:TrainNumberRef> + </netex:trainNumbers> + <netex:passingTimes> + <netex:TimetabledPassingTime version="any"> + <netex:ArrivalTime>23:58:00.000</netex:ArrivalTime> + <netex:ArrivalDayOffset>0</netex:ArrivalDayOffset> + <netex:DepartureTime>23:59:00.000</netex:DepartureTime> + <netex:DepartureDayOffset>0</netex:DepartureDayOffset> + </netex:TimetabledPassingTime> + <netex:TimetabledPassingTime version="any"> + <netex:ArrivalTime>00:03:00.000</netex:ArrivalTime> + <netex:ArrivalDayOffset>1</netex:ArrivalDayOffset> + <netex:DepartureTime>00:04:00.000</netex:DepartureTime> + <netex:DepartureDayOffset>1</netex:DepartureDayOffset> + </netex:TimetabledPassingTime> + </netex:passingTimes> + </netex:ServiceJourney> + </netex:serviceJourneys> + </netex:members> + </netex:GeneralFrame> + </netex:frames> + </netex:CompositeFrame> + </netex:dataObjects> +</netex:PublicationDelivery> diff --git a/spec/fixtures/target/OFFRE_TRANSDEV_20170301122519/calendriers.xml b/spec/fixtures/target/OFFRE_TRANSDEV_20170301122519/calendriers.xml new file mode 100644 index 000000000..1043e0cde --- /dev/null +++ b/spec/fixtures/target/OFFRE_TRANSDEV_20170301122519/calendriers.xml @@ -0,0 +1,80 @@ +<?xml version="1.0" encoding="UTF-8"?> +<netex:PublicationDelivery xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.netex.org.uk/netex ../../xsd/NeTEx_publication.xsd" xmlns:netex="http://www.netex.org.uk/netex" + xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ifopt="http://www.ifopt.org.uk/ifopt" + xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:core="http://www.govtalk.gov.uk/core" + xmlns:siri="http://www.siri.org.uk/siri" version="1.0"> + <netex:PublicationTimestamp>2017-02-14T09:13:51.0</netex:PublicationTimestamp> + <netex:ParticipantRef>CITYWAY</netex:ParticipantRef> + <netex:dataObjects> + <netex:GeneralFrame id="CITYWAY:GeneralFrame:NETEX_CALENDRIER-1_20170214090012:LOC" version="any"> + <netex:ValidBetween> + <netex:FromDate>2017-04-01T00:00:00</netex:FromDate> + <netex:ToDate>2017-12-31T00:00:00</netex:ToDate> + </netex:ValidBetween> + <netex:TypeOfFrameRef ref="NETEX_CALENDRIER"/> + <netex:members> + <netex:DayType id="CITYWAY:DayType:1:LOC" version="any"> + <netex:Name>Semaine</netex:Name> + <netex:properties> + <netex:PropertyOfDay> + <netex:DaysOfWeek>Monday</netex:DaysOfWeek> + </netex:PropertyOfDay> + <netex:PropertyOfDay> + <netex:DaysOfWeek>Tuesday</netex:DaysOfWeek> + </netex:PropertyOfDay> + <netex:PropertyOfDay> + <netex:DaysOfWeek>Wednesday</netex:DaysOfWeek> + </netex:PropertyOfDay> + <netex:PropertyOfDay> + <netex:DaysOfWeek>Thursday</netex:DaysOfWeek> + </netex:PropertyOfDay> + <netex:PropertyOfDay> + <netex:DaysOfWeek>Friday</netex:DaysOfWeek> + </netex:PropertyOfDay> + </netex:properties> + </netex:DayType> + <netex:DayType id="CITYWAY:DayType:2:LOC" version="any"> + <netex:Name>Fin de semaine</netex:Name> + <netex:properties> + <netex:PropertyOfDay> + <netex:DaysOfWeek>Saturday</netex:DaysOfWeek> + </netex:PropertyOfDay> + <netex:PropertyOfDay> + <netex:DaysOfWeek>Sunday</netex:DaysOfWeek> + </netex:PropertyOfDay> + </netex:properties> + </netex:DayType> + <netex:DayType id="CITYWAY:DayType:3:LOC" version="any"> + <netex:Name>Service spécial</netex:Name> + </netex:DayType> + <netex:DayType id="CITYWAY:DayType:4:LOC" version="any"> + <netex:Name>Restriction</netex:Name> + </netex:DayType> + <netex:DayTypeAssignment id="dta1" version="any" order="0"> + <netex:OperatingPeriodRef ref="CITYWAY:OperatingPeriod:1:LOC" version="any"/> + <netex:DayTypeRef ref="CITYWAY:DayType:1:LOC" version="any"/> + </netex:DayTypeAssignment> + <netex:DayTypeAssignment id="dta2" version="any" order="0"> + <netex:OperatingPeriodRef ref="CITYWAY:OperatingPeriod:1:LOC" version="any"/> + <netex:DayTypeRef ref="CITYWAY:DayType:2:LOC" version="any"/> + </netex:DayTypeAssignment> + <netex:DayTypeAssignment id="dta3" version="any" order="0"> + <netex:Date>2017-03-15</netex:Date> + <netex:DayTypeRef ref="CITYWAY:DayType:3:LOC" version="any"/> + <netex:isAvailable>true</netex:isAvailable> + </netex:DayTypeAssignment> + <netex:DayTypeAssignment id="dta4" version="any" order="0"> + <netex:Date>2017-03-15</netex:Date> + <netex:DayTypeRef ref="CITYWAY:DayType:4:LOC" version="any"/> + <netex:isAvailable>false</netex:isAvailable> + </netex:DayTypeAssignment> + <netex:OperatingPeriod id="CITYWAY:OperatingPeriod:1:LOC" version="any"> + <netex:FromDate>2017-01-01T00:00:00</netex:FromDate> + <netex:ToDate>2017-12-31T00:00:00</netex:ToDate> + </netex:OperatingPeriod> + + </netex:members> + </netex:GeneralFrame> + </netex:dataObjects> +</netex:PublicationDelivery> diff --git a/spec/fixtures/target/OFFRE_TRANSDEV_20170301122519/commun.xml b/spec/fixtures/target/OFFRE_TRANSDEV_20170301122519/commun.xml new file mode 100644 index 000000000..f59f8ac2d --- /dev/null +++ b/spec/fixtures/target/OFFRE_TRANSDEV_20170301122519/commun.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<netex:PublicationDelivery xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.netex.org.uk/netex ../../xsd/NeTEx_publication.xsd" xmlns:netex="http://www.netex.org.uk/netex" + xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ifopt="http://www.ifopt.org.uk/ifopt" xmlns:gml="http://www.opengis.net/gml/3.2" + xmlns:core="http://www.govtalk.gov.uk/core" xmlns:siri="http://www.siri.org.uk/siri" version="1.0"> + <netex:PublicationTimestamp>2017-02-14T09:13:51.0</netex:PublicationTimestamp> + <netex:ParticipantRef>CITYWAY</netex:ParticipantRef> + <netex:dataObjects> + <netex:GeneralFrame id="CITYWAY:GeneralFrame:NETEX_COMMUN-1_20170214090012:LOC" version="any"> + <netex:TypeOfFrameRef ref="NETEX_COMMUN"/> + <netex:members> + + <netex:Notice id="CITYWAY:Notice:1:LOC" version="any"> + <netex:Text>Notice 1</netex:Text> + <netex:PublicCode>1</netex:PublicCode> + <netex:TypeOfNoticeRef ref="ServiceJourneyNotice"/> + </netex:Notice> + <netex:Notice id="CITYWAY:Notice:2:LOC" version="any"> + <netex:Text>Notice 2</netex:Text> + <netex:PublicCode>2</netex:PublicCode> + <netex:TypeOfNoticeRef ref="ServiceJourneyNotice"/> + </netex:Notice> + <netex:Notice id="CITYWAY:Notice:3:LOC" version="any"> + <netex:Text>Notice 3</netex:Text> + <netex:PublicCode>3</netex:PublicCode> + <netex:TypeOfNoticeRef ref="ServiceJourneyNotice"/> + </netex:Notice> + + </netex:members> + </netex:GeneralFrame> + </netex:dataObjects> +</netex:PublicationDelivery> diff --git a/spec/fixtures/target/OFFRE_TRANSDEV_20170301122519/offre_C00108_9.xml b/spec/fixtures/target/OFFRE_TRANSDEV_20170301122519/offre_C00108_9.xml new file mode 100644 index 000000000..9eefeeb43 --- /dev/null +++ b/spec/fixtures/target/OFFRE_TRANSDEV_20170301122519/offre_C00108_9.xml @@ -0,0 +1,172 @@ +<?xml version="1.0" encoding="UTF-8"?> +<netex:PublicationDelivery xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.netex.org.uk/netex ../../xsd/NeTEx_publication.xsd" xmlns:netex="http://www.netex.org.uk/netex" + xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ifopt="http://www.ifopt.org.uk/ifopt" + xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:core="http://www.govtalk.gov.uk/core" + xmlns:siri="http://www.siri.org.uk/siri" version="1.0"> + <netex:PublicationTimestamp>2017-02-14T09:13:51.0</netex:PublicationTimestamp> + <netex:ParticipantRef>CITYWAY</netex:ParticipantRef> + <netex:dataObjects> + <netex:CompositeFrame id="CITYWAY:CompositeFrame:NETEX_OFFRE_LIGNE-1:LOC" version="any"> + <netex:Name>Ligne 1</netex:Name> + <netex:TypeOfFrameRef ref="NETEX_OFFRE_LIGNE"/> + <netex:frames> + <netex:GeneralFrame id="CITYWAY:GeneralFrame:NETEX_STRUCTURE-20170214090012:LOC" version="any"> + <netex:TypeOfFrameRef ref="NETEX_STRUCTURE"/> + <netex:members> + + <netex:Route id="CITYWAY:Route:1:LOC" version="any"> + <netex:Name>route 1</netex:Name> + <netex:LineRef ref="STIF:CODIFLIGNE:Line:C00108">version="any"</netex:LineRef> + <netex:DirectionType>outbound</netex:DirectionType> + <netex:DirectionRef ref="CITYWAY:Direction:1:LOC" version="any"/> + <netex:InverseRouteRef ref="CITYWAY:Route:2:LOC" version="any"/> + </netex:Route> + <netex:Route id="CITYWAY:Route:2:LOC" version="any"> + <netex:Name>route 2</netex:Name> + <netex:LineRef ref="STIF:CODIFLIGNE:Line:C00108">version="any"</netex:LineRef> + <netex:DirectionType>inbound</netex:DirectionType> + <netex:DirectionRef ref="CITYWAY:Direction:2:LOC" version="any"/> + <netex:InverseRouteRef ref="CITYWAY:Route:1:LOC" version="any"/> + </netex:Route> + + + <netex:Direction id="CITYWAY:Direction:1:LOC" version="any"> + <netex:Name>Par ici</netex:Name> + </netex:Direction> + <netex:Direction id="CITYWAY:Direction:2:LOC" version="any"> + <netex:Name>Par là </netex:Name> + </netex:Direction> + + + <netex:ServiceJourneyPattern id="CITYWAY:ServiceJourneyPattern:1:LOC" version="any"> + <netex:Name>Par ici</netex:Name> + <netex:RouteRef ref="CITYWAY:Route:1:LOC" version="any"/> + <netex:DestinationDisplayRef ref="CITYWAY:DestinationDisplay:1:LOC" version="any"/> + <netex:pointsInSequence> + <netex:StopPointInJourneyPattern id="CITYWAY:StopPointInJourneyPattern:1-1-1:LOC" order="1" + version="any"> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:1-1:LOC" version="any"/> + <netex:ForAlighting>true</netex:ForAlighting> + <netex:ForBoarding>true</netex:ForBoarding> + </netex:StopPointInJourneyPattern> + <netex:StopPointInJourneyPattern id="CITYWAY:StopPointInJourneyPattern:1-1-2:LOC" order="2" + version="any"> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:1-2:LOC" version="any"/> + <netex:ForAlighting>true</netex:ForAlighting> + <netex:ForBoarding>true</netex:ForBoarding> + </netex:StopPointInJourneyPattern> + </netex:pointsInSequence> + <netex:ServiceJourneyPatternType>passenger</netex:ServiceJourneyPatternType> + </netex:ServiceJourneyPattern> + <netex:ServiceJourneyPattern id="CITYWAY:ServiceJourneyPattern:2:LOC" version="any"> + <netex:Name>Par là </netex:Name> + <netex:RouteRef ref="CITYWAY:Route:2:LOC" version="any"/> + <netex:DestinationDisplayRef ref="CITYWAY:DestinationDisplay:2:LOC" version="any"/> + <netex:pointsInSequence> + <netex:StopPointInJourneyPattern id="CITYWAY:StopPointInJourneyPattern:2-2-1:LOC" order="1" + version="any"> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:2-1:LOC" version="any"/> + <netex:ForAlighting>true</netex:ForAlighting> + <netex:ForBoarding>true</netex:ForBoarding> + </netex:StopPointInJourneyPattern> + <netex:StopPointInJourneyPattern id="CITYWAY:StopPointInJourneyPattern:2-2-2:LOC" order="2" + version="any"> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:2-2:LOC" version="any"/> + <netex:ForAlighting>true</netex:ForAlighting> + <netex:ForBoarding>true</netex:ForBoarding> + </netex:StopPointInJourneyPattern> + </netex:pointsInSequence> + <netex:ServiceJourneyPatternType>passenger</netex:ServiceJourneyPatternType> + </netex:ServiceJourneyPattern> + + + <netex:DestinationDisplay id="CITYWAY:DestinationDisplay:1:LOC" version="any"> + <netex:FrontText>Mission 1</netex:FrontText> + <netex:PublicCode>1234</netex:PublicCode> + </netex:DestinationDisplay> + <netex:DestinationDisplay id="CITYWAY:DestinationDisplay:2:LOC" version="any"> + <netex:FrontText>Mission 2</netex:FrontText> + <netex:PublicCode>2345</netex:PublicCode> + </netex:DestinationDisplay> + + + <netex:ScheduledStopPoint id="CITYWAY:ScheduledStopPoint:1-1:LOC" version="any"/> + <netex:ScheduledStopPoint id="CITYWAY:ScheduledStopPoint:1-2:LOC" version="any"/> + <netex:ScheduledStopPoint id="CITYWAY:ScheduledStopPoint:2-1:LOC" version="any"/> + <netex:ScheduledStopPoint id="CITYWAY:ScheduledStopPoint:2-2:LOC" version="any"/> + + + <netex:PassengerStopAssignment id="CITYWAY:PassengerStopAssignment:1-1:LOC" version="any" order="0"> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:1-1:LOC" version="any"/> + <netex:QuayRef ref="FR:78217:ZDE:50094817:STIF">version="any"</netex:QuayRef> + </netex:PassengerStopAssignment> + <netex:PassengerStopAssignment id="CITYWAY:PassengerStopAssignment:2-1:LOC" version="any" order="0"> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:2-1:LOC" version="any"/> + <netex:QuayRef ref="FR:78217:ZDE:50009052:STIF">version="any"</netex:QuayRef> + </netex:PassengerStopAssignment> + <netex:PassengerStopAssignment id="CITYWAY:PassengerStopAssignment:1-2:LOC" version="any" order="0"> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:1-2:LOC" version="any"/> + <netex:QuayRef ref="FR:78217:ZDE:50009053:STIF">version="any"</netex:QuayRef> + </netex:PassengerStopAssignment> + <netex:PassengerStopAssignment id="CITYWAY:PassengerStopAssignment:2-2:LOC" version="any" order="0"> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:2-2:LOC" version="any"/> + <netex:QuayRef ref="FR:78217:ZDE:50094816:STIF">version="any"</netex:QuayRef> + </netex:PassengerStopAssignment> + + + <netex:RoutingConstraintZone id="CITYWAY:RoutingConstraintZone:1:LOC" version="any"> + <netex:Name>ITL 1</netex:Name> + <netex:members> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:1-1:LOC" version="any"/> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:1-2:LOC" version="any"/> + </netex:members> + <netex:ZoneUse>cannotBoardAndAlightInSameZone</netex:ZoneUse> + </netex:RoutingConstraintZone> + + </netex:members> + </netex:GeneralFrame> + <netex:GeneralFrame id="CITYWAY:GeneralFrame:NETEX_HORAIRE-20170214090012:LOC" version="any"> + <netex:TypeOfFrameRef ref="NETEX_HORAIRE"/> + <netex:members> + + <netex:ServiceJourney id="CITYWAY:ServiceJourney:1-1:LOC" version="any"> + <netex:Name>Course 1 par ici</netex:Name> + <netex:noticeAssignments> + <netex:NoticeAssignment id="ns1" version="any" order="0"> + <netex:NoticeRef ref="CITYWAY:Notice:1:LOC"> + version="any"</netex:NoticeRef> + </netex:NoticeAssignment> + </netex:noticeAssignments> + <netex:dayTypes> + <netex:DayTypeRef ref="CITYWAY:DayType:1:LOC"> version="any"</netex:DayTypeRef> + </netex:dayTypes> + + <netex:JourneyPatternRef ref="CITYWAY:ServiceJourneyPattern:1:LOC" version="any"/> + <netex:OperatorRef ref="STIF:CODIFLIGNE:Operator:011"> + version="any"</netex:OperatorRef> + <netex:trainNumbers> + <netex:TrainNumberRef ref="CITYWAY:TrainNumber:1234:LOC">version="any"</netex:TrainNumberRef> + </netex:trainNumbers> + <netex:passingTimes> + <netex:TimetabledPassingTime version="any"> + <netex:ArrivalTime>01:01:00.000</netex:ArrivalTime> + <netex:ArrivalDayOffset>0</netex:ArrivalDayOffset> + <netex:DepartureTime>01:01:00.000</netex:DepartureTime> + <netex:DepartureDayOffset>0</netex:DepartureDayOffset> + </netex:TimetabledPassingTime> + <netex:TimetabledPassingTime version="any"> + <netex:ArrivalTime>01:05:00.000</netex:ArrivalTime> + <netex:ArrivalDayOffset>0</netex:ArrivalDayOffset> + <netex:DepartureTime>01:05:00.000</netex:DepartureTime> + <netex:DepartureDayOffset>0</netex:DepartureDayOffset> + </netex:TimetabledPassingTime> + </netex:passingTimes> + </netex:ServiceJourney> + + </netex:members> + </netex:GeneralFrame> + </netex:frames> + </netex:CompositeFrame> + </netex:dataObjects> +</netex:PublicationDelivery> diff --git a/spec/fixtures/target/OFFRE_TRANSDEV_20170301122519/offre_C00109_10.xml b/spec/fixtures/target/OFFRE_TRANSDEV_20170301122519/offre_C00109_10.xml new file mode 100644 index 000000000..d260ef17e --- /dev/null +++ b/spec/fixtures/target/OFFRE_TRANSDEV_20170301122519/offre_C00109_10.xml @@ -0,0 +1,172 @@ +<?xml version="1.0" encoding="UTF-8"?> +<netex:PublicationDelivery xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.netex.org.uk/netex ../../xsd/NeTEx_publication.xsd" xmlns:netex="http://www.netex.org.uk/netex" + xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ifopt="http://www.ifopt.org.uk/ifopt" + xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:core="http://www.govtalk.gov.uk/core" + xmlns:siri="http://www.siri.org.uk/siri" version="1.0"> + <netex:PublicationTimestamp>2017-02-14T09:13:51.0</netex:PublicationTimestamp> + <netex:ParticipantRef>CITYWAY</netex:ParticipantRef> + <netex:dataObjects> + <netex:CompositeFrame id="CITYWAY:CompositeFrame:NETEX_OFFRE_LIGNE-1:LOC" version="any"> + <netex:Name>Ligne 1</netex:Name> + <netex:TypeOfFrameRef ref="NETEX_OFFRE_LIGNE"/> + <netex:frames> + <netex:GeneralFrame id="CITYWAY:GeneralFrame:NETEX_STRUCTURE-20170214090012:LOC" version="any"> + <netex:TypeOfFrameRef ref="NETEX_STRUCTURE"/> + <netex:members> + + <netex:Route id="CITYWAY:Route:1:LOC" version="any"> + <netex:Name>route 1</netex:Name> + <netex:LineRef ref="STIF:CODIFLIGNE:Line:C00109">version="any"</netex:LineRef> + <netex:DirectionType>outbound</netex:DirectionType> + <netex:DirectionRef ref="CITYWAY:Direction:1:LOC" version="any"/> + <netex:InverseRouteRef ref="CITYWAY:Route:2:LOC" version="any"/> + </netex:Route> + <netex:Route id="CITYWAY:Route:2:LOC" version="any"> + <netex:Name>route 2</netex:Name> + <netex:LineRef ref="STIF:CODIFLIGNE:Line:C00109">version="any"</netex:LineRef> + <netex:DirectionType>inbound</netex:DirectionType> + <netex:DirectionRef ref="CITYWAY:Direction:2:LOC" version="any"/> + <netex:InverseRouteRef ref="CITYWAY:Route:1:LOC" version="any"/> + </netex:Route> + + + <netex:Direction id="CITYWAY:Direction:1:LOC" version="any"> + <netex:Name>Par ici aussi</netex:Name> + </netex:Direction> + <netex:Direction id="CITYWAY:Direction:2:LOC" version="any"> + <netex:Name>Par là aussi</netex:Name> + </netex:Direction> + + + <netex:ServiceJourneyPattern id="CITYWAY:ServiceJourneyPattern:1:LOC" version="any"> + <netex:Name>Par ici itou</netex:Name> + <netex:RouteRef ref="CITYWAY:Route:1:LOC" version="any"/> + <netex:DestinationDisplayRef ref="CITYWAY:DestinationDisplay:1:LOC" version="any"/> + <netex:pointsInSequence> + <netex:StopPointInJourneyPattern id="CITYWAY:StopPointInJourneyPattern:1-1-1:LOC" order="1" + version="any"> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:1-1:LOC" version="any"/> + <netex:ForAlighting>true</netex:ForAlighting> + <netex:ForBoarding>true</netex:ForBoarding> + </netex:StopPointInJourneyPattern> + <netex:StopPointInJourneyPattern id="CITYWAY:StopPointInJourneyPattern:1-1-2:LOC" order="2" + version="any"> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:1-2:LOC" version="any"/> + <netex:ForAlighting>true</netex:ForAlighting> + <netex:ForBoarding>true</netex:ForBoarding> + </netex:StopPointInJourneyPattern> + </netex:pointsInSequence> + <netex:ServiceJourneyPatternType>passenger</netex:ServiceJourneyPatternType> + </netex:ServiceJourneyPattern> + <netex:ServiceJourneyPattern id="CITYWAY:ServiceJourneyPattern:2:LOC" version="any"> + <netex:Name>Par là itou</netex:Name> + <netex:RouteRef ref="CITYWAY:Route:2:LOC" version="any"/> + <netex:DestinationDisplayRef ref="CITYWAY:DestinationDisplay:2:LOC" version="any"/> + <netex:pointsInSequence> + <netex:StopPointInJourneyPattern id="CITYWAY:StopPointInJourneyPattern:2-2-1:LOC" order="1" + version="any"> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:2-1:LOC" version="any"/> + <netex:ForAlighting>true</netex:ForAlighting> + <netex:ForBoarding>true</netex:ForBoarding> + </netex:StopPointInJourneyPattern> + <netex:StopPointInJourneyPattern id="CITYWAY:StopPointInJourneyPattern:2-2-2:LOC" order="2" + version="any"> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:2-2:LOC" version="any"/> + <netex:ForAlighting>true</netex:ForAlighting> + <netex:ForBoarding>true</netex:ForBoarding> + </netex:StopPointInJourneyPattern> + </netex:pointsInSequence> + <netex:ServiceJourneyPatternType>passenger</netex:ServiceJourneyPatternType> + </netex:ServiceJourneyPattern> + + + <netex:DestinationDisplay id="CITYWAY:DestinationDisplay:1:LOC" version="any"> + <netex:FrontText>Mission 1 bis</netex:FrontText> + <netex:PublicCode>1234</netex:PublicCode> + </netex:DestinationDisplay> + <netex:DestinationDisplay id="CITYWAY:DestinationDisplay:2:LOC" version="any"> + <netex:FrontText>Mission 2 bis</netex:FrontText> + <netex:PublicCode>2345</netex:PublicCode> + </netex:DestinationDisplay> + + + <netex:ScheduledStopPoint id="CITYWAY:ScheduledStopPoint:1-1:LOC" version="any"/> + <netex:ScheduledStopPoint id="CITYWAY:ScheduledStopPoint:1-2:LOC" version="any"/> + <netex:ScheduledStopPoint id="CITYWAY:ScheduledStopPoint:2-1:LOC" version="any"/> + <netex:ScheduledStopPoint id="CITYWAY:ScheduledStopPoint:2-2:LOC" version="any"/> + + + <netex:PassengerStopAssignment id="CITYWAY:PassengerStopAssignment:1-1:LOC" version="any" order="0"> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:1-1:LOC" version="any"/> + <netex:QuayRef ref="FR:78217:ZDE:50094817:STIF">version="any"</netex:QuayRef> + </netex:PassengerStopAssignment> + <netex:PassengerStopAssignment id="CITYWAY:PassengerStopAssignment:2-1:LOC" version="any" order="0"> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:2-1:LOC" version="any"/> + <netex:QuayRef ref="FR:78402:ZDE:50000918:STIF">version="any"</netex:QuayRef> + </netex:PassengerStopAssignment> + <netex:PassengerStopAssignment id="CITYWAY:PassengerStopAssignment:1-2:LOC" version="any" order="0"> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:1-2:LOC" version="any"/> + <netex:QuayRef ref="FR:78402:ZDE:50000917:STIF">version="any"</netex:QuayRef> + </netex:PassengerStopAssignment> + <netex:PassengerStopAssignment id="CITYWAY:PassengerStopAssignment:2-2:LOC" version="any" order="0"> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:2-2:LOC" version="any"/> + <netex:QuayRef ref="FR:78217:ZDE:50094816:STIF">version="any"</netex:QuayRef> + </netex:PassengerStopAssignment> + + + <netex:RoutingConstraintZone id="CITYWAY:RoutingConstraintZone:1:LOC" version="any"> + <netex:Name>ITL 1</netex:Name> + <netex:members> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:1-1:LOC" version="any"/> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:1-2:LOC" version="any"/> + </netex:members> + <netex:ZoneUse>cannotBoardAndAlightInSameZone</netex:ZoneUse> + </netex:RoutingConstraintZone> + + </netex:members> + </netex:GeneralFrame> + <netex:GeneralFrame id="CITYWAY:GeneralFrame:NETEX_HORAIRE-20170214090012:LOC" version="any"> + <netex:TypeOfFrameRef ref="NETEX_HORAIRE"/> + <netex:members> + + <netex:ServiceJourney id="CITYWAY:ServiceJourney:1-1:LOC" version="any"> + <netex:Name>Course 1 par ici aussi</netex:Name> + <netex:noticeAssignments> + <netex:NoticeAssignment id="ns1" version="any" order="0"> + <netex:NoticeRef ref="CITYWAY:Notice:2:LOC"> + version="any"</netex:NoticeRef> + </netex:NoticeAssignment> + </netex:noticeAssignments> + <netex:dayTypes> + <netex:DayTypeRef ref="CITYWAY:DayType:1:LOC"> version="any"</netex:DayTypeRef> + <netex:DayTypeRef ref="CITYWAY:DayType:4:LOC"> version="any"</netex:DayTypeRef> + </netex:dayTypes> + <netex:JourneyPatternRef ref="CITYWAY:ServiceJourneyPattern:1:LOC" version="any"/> + <netex:OperatorRef ref="STIF:CODIFLIGNE:Operator:212"> + version="any"</netex:OperatorRef> + <netex:trainNumbers> + <netex:TrainNumberRef ref="CITYWAY:TrainNumber:1234:LOC">version="any"</netex:TrainNumberRef> + </netex:trainNumbers> + <netex:passingTimes> + <netex:TimetabledPassingTime version="any"> + <netex:ArrivalTime>23:58:00.000</netex:ArrivalTime> + <netex:ArrivalDayOffset>0</netex:ArrivalDayOffset> + <netex:DepartureTime>23:59:00.000</netex:DepartureTime> + <netex:DepartureDayOffset>0</netex:DepartureDayOffset> + </netex:TimetabledPassingTime> + <netex:TimetabledPassingTime version="any"> + <netex:ArrivalTime>00:03:00.000</netex:ArrivalTime> + <netex:ArrivalDayOffset>1</netex:ArrivalDayOffset> + <netex:DepartureTime>00:04:00.000</netex:DepartureTime> + <netex:DepartureDayOffset>1</netex:DepartureDayOffset> + </netex:TimetabledPassingTime> + </netex:passingTimes> + </netex:ServiceJourney> + + </netex:members> + </netex:GeneralFrame> + </netex:frames> + </netex:CompositeFrame> + </netex:dataObjects> +</netex:PublicationDelivery> diff --git a/spec/helpers/table_builder_helper/column_spec.rb b/spec/helpers/table_builder_helper/column_spec.rb index 0f27703b2..e0bfd8a6a 100644 --- a/spec/helpers/table_builder_helper/column_spec.rb +++ b/spec/helpers/table_builder_helper/column_spec.rb @@ -20,4 +20,43 @@ describe TableBuilderHelper::Column do ).to eq('Numéro de téléphone') end end + + describe "#linkable?" do + it "returns true if :link_to is not nil" do + expect( + TableBuilderHelper::Column.new( + name: 'unused', + attribute: nil, + link_to: lambda do + train.kind + end + ).linkable? + ).to be true + end + + it "returns false if :link_to is nil" do + expect( + TableBuilderHelper::Column.new( + name: 'unused', + attribute: nil + ).linkable? + ).to be false + end + end + + describe "#link_to" do + it "calls the block passed in and returns the result" do + train = double('train', kind: 'TGV') + + expect( + TableBuilderHelper::Column.new( + name: 'unused', + attribute: nil, + link_to: lambda do |train| + train.kind + end + ).link_to(train) + ).to eq('TGV') + end + end end diff --git a/spec/helpers/table_builder_helper_spec.rb b/spec/helpers/table_builder_helper_spec.rb index c536a4c62..e17196a19 100644 --- a/spec/helpers/table_builder_helper_spec.rb +++ b/spec/helpers/table_builder_helper_spec.rb @@ -96,7 +96,10 @@ describe TableBuilderHelper, type: :helper do [ TableBuilderHelper::Column.new( key: :name, - attribute: 'name' + attribute: 'name', + link_to: lambda do |referential| + referential_path(referential) + end ), TableBuilderHelper::Column.new( key: :status, @@ -238,7 +241,10 @@ describe TableBuilderHelper, type: :helper do ), TableBuilderHelper::Column.new( key: :name, - attribute: 'name' + attribute: 'name', + link_to: lambda do |company| + referential_company_path(referential, company) + end ), TableBuilderHelper::Column.new( key: :phone, @@ -347,7 +353,10 @@ describe TableBuilderHelper, type: :helper do ), TableBuilderHelper::Column.new( key: :name, - attribute: 'name' + attribute: 'name', + link_to: lambda do |company| + referential_company_path(referential, company) + end ), TableBuilderHelper::Column.new( key: :phone, diff --git a/spec/javascripts/time_table/actions_spec.js b/spec/javascripts/time_table/actions_spec.js index ebd1bb04c..f052aeece 100644 --- a/spec/javascripts/time_table/actions_spec.js +++ b/spec/javascripts/time_table/actions_spec.js @@ -158,33 +158,41 @@ describe('actions', () => { let modalProps = {} let timeTablePeriods = [] let metas = {} + let timetableInDates = [] + let error = '' const expectedAction = { type: 'VALIDATE_PERIOD_FORM', modalProps, timeTablePeriods, - metas + metas, + timetableInDates, + error } - expect(actions.validatePeriodForm(modalProps, timeTablePeriods, metas)).toEqual(expectedAction) + expect(actions.validatePeriodForm(modalProps, timeTablePeriods, metas, timetableInDates, error)).toEqual(expectedAction) }) it('should create an action to include date in period', () => { let index = 1 + let date = actions.formatDate(new Date) const expectedAction = { type: 'INCLUDE_DATE_IN_PERIOD', index, - dayTypes + dayTypes, + date } - expect(actions.includeDateInPeriod(index, dayTypes)).toEqual(expectedAction) + expect(actions.includeDateInPeriod(index, dayTypes, date)).toEqual(expectedAction) }) it('should create an action to exclude date from period', () => { let index = 1 + let date = actions.formatDate(new Date) const expectedAction = { type: 'EXCLUDE_DATE_FROM_PERIOD', index, - dayTypes + dayTypes, + date } - expect(actions.excludeDateFromPeriod(index, dayTypes)).toEqual(expectedAction) + expect(actions.excludeDateFromPeriod(index, dayTypes, date)).toEqual(expectedAction) }) it('should create an action to open confirm modal', () => { diff --git a/spec/javascripts/time_table/reducers/modal_spec.js b/spec/javascripts/time_table/reducers/modal_spec.js index 4246027b8..570eb85ed 100644 --- a/spec/javascripts/time_table/reducers/modal_spec.js +++ b/spec/javascripts/time_table/reducers/modal_spec.js @@ -154,7 +154,7 @@ describe('modal reducer', () => { error: '' } let newModalProps = { - active: false, + active: true, begin: { day: '01', month: '01', @@ -170,12 +170,15 @@ describe('modal reducer', () => { } let ttperiods = [] + let ttdates = [] expect( modalReducer(state, { type: 'VALIDATE_PERIOD_FORM', modalProps : modProps, - timeTablePeriods: ttperiods + timeTablePeriods: ttperiods, + timetableInDates: ttdates, + error: 'La date de départ doit être antérieure à la date de fin' }) ).toEqual(Object.assign({}, state, {modalProps: newModalProps})) }) @@ -222,6 +225,8 @@ describe('modal reducer', () => { {id: 265, period_start: '2017-05-14', period_end: '2017-05-24'} ] + let ttdates2 = [] + let newModalProps2 = { active: true, begin: { @@ -242,8 +247,76 @@ describe('modal reducer', () => { modalReducer(state2, { type: 'VALIDATE_PERIOD_FORM', modalProps : modProps2, - timeTablePeriods: ttperiods2 + timeTablePeriods: ttperiods2, + timetableInDates: ttdates2, + error: "Les périodes ne peuvent pas se chevaucher" }) ).toEqual(Object.assign({}, state2, {modalProps: newModalProps2})) }) + + it('should handle VALIDATE_PERIOD_FORM and throw error if period overlaps date', () => { + let state3 = { + confirmModal: {}, + modalProps: { + active: false, + begin: { + day: '01', + month: '08', + year: '2017' + }, + end: { + day: '09', + month: '08', + year: '2017' + }, + index: false, + error: '' + }, + type: '' + } + let modProps3 = { + active: true, + begin: { + day: '01', + month: '08', + year: '2017' + }, + end: { + day: '09', + month: '08', + year: '2017' + }, + index: false, + error: '' + } + let ttperiods3 = [] + + let ttdates3 = [{date: "2017-08-04", include_date: true}] + + let newModalProps3 = { + active: true, + begin: { + day: '01', + month: '08', + year: '2017' + }, + end: { + day: '09', + month: '08', + year: '2017' + }, + index: false, + error: "Une période ne peut chevaucher une date dans un calendrier" + } + + expect( + modalReducer(state3, { + type: 'VALIDATE_PERIOD_FORM', + modalProps : modProps3, + timeTablePeriods: ttperiods3, + timetableInDates: ttdates3, + error: "Une période ne peut chevaucher une date dans un calendrier" + }) + ).toEqual(Object.assign({}, state3, {modalProps: newModalProps3})) + }) }) diff --git a/spec/javascripts/time_table/reducers/timetable_spec.js b/spec/javascripts/time_table/reducers/timetable_spec.js index 0b418a52e..6585a78a0 100644 --- a/spec/javascripts/time_table/reducers/timetable_spec.js +++ b/spec/javascripts/time_table/reducers/timetable_spec.js @@ -12,12 +12,15 @@ let current_month = [{"day":"lundi","date":"2017-05-01","wday":1,"wnumber":"18", let newCurrentMonth = [{"day":"lundi","date":"2017-05-01","wday":1,"wnumber":"18","mday":1,"include_date":false,"excluded_date":false,"in_periods":true},{"day":"mardi","date":"2017-05-02","wday":2,"wnumber":"18","mday":2,"include_date":false,"excluded_date":false,"in_periods":true},{"day":"mercredi","date":"2017-05-03","wday":3,"wnumber":"18","mday":3,"include_date":false,"excluded_date":false,"in_periods":true},{"day":"jeudi","date":"2017-05-04","wday":4,"wnumber":"18","mday":4,"include_date":false,"excluded_date":false,"in_periods":true},{"day":"vendredi","date":"2017-05-05","wday":5,"wnumber":"18","mday":5,"include_date":false,"excluded_date":false,"in_periods":false},{"day":"samedi","date":"2017-05-06","wday":6,"wnumber":"18","mday":6,"include_date":false,"excluded_date":false,"in_periods":false},{"day":"dimanche","date":"2017-05-07","wday":0,"wnumber":"18","mday":7,"include_date":false,"excluded_date":false,"in_periods":false},{"day":"lundi","date":"2017-05-08","wday":1,"wnumber":"19","mday":8,"include_date":false,"excluded_date":false,"in_periods":false},{"day":"mardi","date":"2017-05-09","wday":2,"wnumber":"19","mday":9,"include_date":false,"excluded_date":false,"in_periods":false},{"day":"mercredi","date":"2017-05-10","wday":3,"wnumber":"19","mday":10,"include_date":false,"excluded_date":false,"in_periods":false},{"day":"jeudi","date":"2017-05-11","wday":4,"wnumber":"19","mday":11,"include_date":false,"excluded_date":false,"in_periods":false},{"day":"vendredi","date":"2017-05-12","wday":5,"wnumber":"19","mday":12,"include_date":false,"excluded_date":false,"in_periods":false},{"day":"samedi","date":"2017-05-13","wday":6,"wnumber":"19","mday":13,"include_date":false,"excluded_date":false,"in_periods":false},{"day":"dimanche","date":"2017-05-14","wday":0,"wnumber":"19","mday":14,"include_date":false,"excluded_date":false,"in_periods":true},{"day":"lundi","date":"2017-05-15","wday":1,"wnumber":"20","mday":15,"include_date":false,"excluded_date":false,"in_periods":true},{"day":"mardi","date":"2017-05-16","wday":2,"wnumber":"20","mday":16,"include_date":false,"excluded_date":false,"in_periods":true},{"day":"mercredi","date":"2017-05-17","wday":3,"wnumber":"20","mday":17,"include_date":false,"excluded_date":false,"in_periods":true},{"day":"jeudi","date":"2017-05-18","wday":4,"wnumber":"20","mday":18,"include_date":false,"excluded_date":false,"in_periods":true},{"day":"vendredi","date":"2017-05-19","wday":5,"wnumber":"20","mday":19,"include_date":false,"excluded_date":false,"in_periods":true},{"day":"samedi","date":"2017-05-20","wday":6,"wnumber":"20","mday":20,"include_date":false,"excluded_date":false,"in_periods":true},{"day":"dimanche","date":"2017-05-21","wday":0,"wnumber":"20","mday":21,"include_date":false,"excluded_date":false,"in_periods":true},{"day":"lundi","date":"2017-05-22","wday":1,"wnumber":"21","mday":22,"include_date":false,"excluded_date":false,"in_periods":true},{"day":"mardi","date":"2017-05-23","wday":2,"wnumber":"21","mday":23,"include_date":false,"excluded_date":false,"in_periods":true},{"day":"mercredi","date":"2017-05-24","wday":3,"wnumber":"21","mday":24,"include_date":false,"excluded_date":false,"in_periods":true},{"day":"jeudi","date":"2017-05-25","wday":4,"wnumber":"21","mday":25,"include_date":false,"excluded_date":false,"in_periods":false},{"day":"vendredi","date":"2017-05-26","wday":5,"wnumber":"21","mday":26,"include_date":false,"excluded_date":false,"in_periods":false},{"day":"samedi","date":"2017-05-27","wday":6,"wnumber":"21","mday":27,"include_date":false,"excluded_date":false,"in_periods":false},{"day":"dimanche","date":"2017-05-28","wday":0,"wnumber":"21","mday":28,"include_date":false,"excluded_date":false,"in_periods":false},{"day":"lundi","date":"2017-05-29","wday":1,"wnumber":"22","mday":29,"include_date":false,"excluded_date":false,"in_periods":false},{"day":"mardi","date":"2017-05-30","wday":2,"wnumber":"22","mday":30,"include_date":false,"excluded_date":false,"in_periods":false},{"day":"mercredi","date":"2017-05-31","wday":3,"wnumber":"22","mday":31,"include_date":false,"excluded_date":false,"in_periods":false}] +let time_table_dates = [] + let json = { current_month: current_month, current_periode_range: current_periode_range, periode_range: periode_range, time_table_periods: time_table_periods, - day_types: strDayTypes + day_types: strDayTypes, + time_table_dates: time_table_dates } describe('timetable reducer with empty state', () => { @@ -26,7 +29,8 @@ describe('timetable reducer with empty state', () => { current_month: [], current_periode_range: "", periode_range: [], - time_table_periods: [] + time_table_periods: [], + time_table_dates: [] } }) @@ -42,6 +46,7 @@ describe('timetable reducer with empty state', () => { current_periode_range: current_periode_range, periode_range: periode_range, time_table_periods: time_table_periods, + time_table_dates: time_table_dates } expect( timetableReducer(state, { @@ -59,6 +64,7 @@ describe('timetable reducer with filled state', () => { current_periode_range: current_periode_range, periode_range: periode_range, time_table_periods: time_table_periods, + time_table_dates: time_table_dates } }) @@ -130,45 +136,92 @@ describe('timetable reducer with filled state', () => { ).toEqual(state) }) - it('should handle INCLUDE_DATE_IN_PERIOD', () => { + it('should handle INCLUDE_DATE_IN_PERIOD and add in_day if TT doesnt have it', () => { + let newDates = state.time_table_dates.concat({date: "2017-05-05", in_out: true}) + let newState = Object.assign({}, state, {time_table_dates: newDates}) state.current_month[4].include_date = true expect( timetableReducer(state, { type: 'INCLUDE_DATE_IN_PERIOD', index: 4, - dayTypes: arrDayTypes + dayTypes: arrDayTypes, + date: "2017-05-05" }) - ).toEqual(state) + ).toEqual(newState) + }) + + it('should handle INCLUDE_DATE_IN_PERIOD and remove in_day if TT has it', () => { + state.current_month[4].include_date = true + state.time_table_dates.push({date: "2017-05-05", in_out: true}) + let newState = Object.assign({}, state, {time_table_dates: []}) + expect( + timetableReducer(state, { + type: 'INCLUDE_DATE_IN_PERIOD', + index: 4, + dayTypes: arrDayTypes, + date: "2017-05-05" + }) + ).toEqual(newState) }) - it('should handle EXCLUDE_DATE_FROM_PERIOD', () => { + it('should handle EXCLUDE_DATE_FROM_PERIOD and add out_day if TT doesnt have it', () => { + let newDates = state.time_table_dates.concat({date: "2017-05-01", in_out: false}) + let newState = Object.assign({}, state, {time_table_dates: newDates}) state.current_month[0].excluded_date = true expect( timetableReducer(state, { type: 'EXCLUDE_DATE_FROM_PERIOD', index: 0, - dayTypes: arrDayTypes + dayTypes: arrDayTypes, + date: "2017-05-01" }) - ).toEqual(state) + ).toEqual(newState) }) - it('should handle VALIDATE_PERIOD_FORM', () => { - state.current_month[13].in_periods = false - state.time_table_periods[4].period_start = '2017-05-15' + it('should handle EXCLUDE_DATE_FROM_PERIOD and remove out_day if TT has it', () => { + state.time_table_dates = [{date: "2017-05-01", in_out: false}] + state.current_month[0].excluded_date = true + let newState = Object.assign({}, state, {time_table_dates: []}) + expect( + timetableReducer(state, { + type: 'EXCLUDE_DATE_FROM_PERIOD', + index: 0, + dayTypes: arrDayTypes, + date: "2017-05-01" + }) + ).toEqual(newState) + }) + + it('should handle UPDATE_DAY_TYPES and remove out_day that are out of day types', () => { + state.time_table_dates = [{date: "2017-05-01", in_out: false}] + let newArrDayTypes = arrDayTypes.slice(0) + newArrDayTypes[1] = false + let newState = Object.assign({}, state, {time_table_dates: []}) + expect( + timetableReducer(state, { + type: 'UPDATE_DAY_TYPES', + dayTypes: newArrDayTypes + }).time_table_dates + ).toEqual([]) + }) + + it('should handle VALIDATE_PERIOD_FORM and add period if modalProps index = false', () => { + let newPeriods = state.time_table_periods.concat({"period_start": "2018-05-15", "period_end": "2018-05-24"}) + let newState = Object.assign({}, state, {time_table_periods: newPeriods}) let modalProps = { active: false, begin: { day: '15', month: '05', - year: '2017' + year: '2018' }, end: { day: '24', month: '05', - year: '2017' + year: '2018' }, error: '', - index: 4 + index: false } expect( timetableReducer(state, { @@ -177,8 +230,10 @@ describe('timetable reducer with filled state', () => { timeTablePeriods: state.time_table_periods, metas: { day_types: arrDayTypes - } + }, + timetableInDates: state.time_table_dates.filter(d => d.in_out == true), + error: modalProps.error }) - ).toEqual(state) + ).toEqual(newState) }) }) diff --git a/spec/javascripts/vehicle_journeys/actions_spec.js b/spec/javascripts/vehicle_journeys/actions_spec.js index d96baf8ef..707ae22cb 100644 --- a/spec/javascripts/vehicle_journeys/actions_spec.js +++ b/spec/javascripts/vehicle_journeys/actions_spec.js @@ -165,12 +165,12 @@ describe('when updating vjas time', () => { }) describe('when clicking on validate button inside shifting modal', () => { it('should create an action to shift a vehiclejourney schedule', () => { - const data = {} + const addtionalTime = 0 const expectedAction = { type: 'SHIFT_VEHICLEJOURNEY', - data + addtionalTime } - expect(actions.shiftVehicleJourney(data)).toEqual(expectedAction) + expect(actions.shiftVehicleJourney(addtionalTime)).toEqual(expectedAction) }) }) describe('when clicking on validate button inside editing modal', () => { @@ -187,14 +187,16 @@ describe('when clicking on validate button inside editing modal', () => { }) describe('when clicking on validate button inside duplicating modal', () => { it('should create an action to duplicate a vehiclejourney schedule', () => { - const data = {} + const addtionalTime = 0 const departureDelta = 0 + const duplicateNumber = 1 const expectedAction = { type: 'DUPLICATE_VEHICLEJOURNEY', - data, + addtionalTime, + duplicateNumber, departureDelta } - expect(actions.duplicateVehicleJourney(data, departureDelta)).toEqual(expectedAction) + expect(actions.duplicateVehicleJourney(addtionalTime, duplicateNumber, departureDelta)).toEqual(expectedAction) }) }) describe('when clicking on edit notes modal', () => { @@ -432,3 +434,16 @@ describe('when using select2 to pick a company', () => { expect(actions.select2Company(selectedCompany)).toEqual(expectedAction) }) }) +describe('when using select2 to unselect a company', () => { + it('should create an action to unselect a company inside modal', () => { + let selectedCompany = { + id: 1, + objectid: 2, + name: 'test', + } + const expectedAction = { + type: 'UNSELECT_CP_EDIT_MODAL' + } + expect(actions.unselect2Company()).toEqual(expectedAction) + }) +}) diff --git a/spec/javascripts/vehicle_journeys/reducers/modal_spec.js b/spec/javascripts/vehicle_journeys/reducers/modal_spec.js index c016812da..4530b5ee7 100644 --- a/spec/javascripts/vehicle_journeys/reducers/modal_spec.js +++ b/spec/javascripts/vehicle_journeys/reducers/modal_spec.js @@ -167,4 +167,13 @@ describe('modal reducer', () => { }) ).toEqual(Object.assign({}, state, {modalProps: newModalProps})) }) + + it('should handle UNSELECT_CP_EDIT_MODAL', () => { + let newModalProps = {selectedCompany : undefined} + expect( + modalReducer(state, { + type: 'UNSELECT_CP_EDIT_MODAL' + }) + ).toEqual(Object.assign({}, state, {modalProps: newModalProps})) + }) }) diff --git a/spec/javascripts/vehicle_journeys/reducers/vehicle_journeys_spec.js b/spec/javascripts/vehicle_journeys/reducers/vehicle_journeys_spec.js index 620e2ffdd..3b2137a2a 100644 --- a/spec/javascripts/vehicle_journeys/reducers/vehicle_journeys_spec.js +++ b/spec/javascripts/vehicle_journeys/reducers/vehicle_journeys_spec.js @@ -198,15 +198,12 @@ describe('vehicleJourneys reducer', () => { }, stop_area_object_id : "FR:92024:ZDE:420553:STIF" }] - let fakeData = { - objectid: {value : '11'}, - additional_time: {value: '5'} - } + let addtionalTime = 5 let newVJ = Object.assign({}, state[0], {vehicle_journey_at_stops: newVJAS}) expect( vjReducer(state, { type: 'SHIFT_VEHICLEJOURNEY', - data: fakeData + addtionalTime }) ).toEqual([newVJ, state[1]]) }) @@ -225,17 +222,17 @@ describe('vehicleJourneys reducer', () => { stop_area_object_id : "FR:92024:ZDE:420553:STIF" }] let departureDelta = 1 - let fakeData = { - duplicate_number: {value : 1}, - additional_time: {value: '5'} - } + let addtionalTime = 5 + let duplicateNumber = 1 + let newVJ = Object.assign({}, state[0], {vehicle_journey_at_stops: newVJAS, selected: false}) newVJ.published_journey_name = state[0].published_journey_name + '-0' delete newVJ['objectid'] expect( vjReducer(state, { type: 'DUPLICATE_VEHICLEJOURNEY', - data: fakeData, + addtionalTime, + duplicateNumber, departureDelta }) ).toEqual([state[0], newVJ, state[1]]) diff --git a/spec/lib/stif/netex_file_spec.rb b/spec/lib/stif/netex_file_spec.rb new file mode 100644 index 000000000..d84807fe5 --- /dev/null +++ b/spec/lib/stif/netex_file_spec.rb @@ -0,0 +1,27 @@ +require "rails_helper" + +RSpec.describe STIF::NetexFile do + + let( :zip_file ){ fixtures_path 'OFFRE_TRANSDEV_2017030112251.zip' } + + let(:frames) { STIF::NetexFile.new(zip_file).frames } + + it "should return a frame for each sub directory" do + expect(frames.size).to eq(2) + end + + def period(from, to) + Range.new(Date.parse(from), Date.parse(to)) + end + + + context "each frame" do + it "should return the line identifiers defined in frame" do + expect(frames.map(&:line_refs)).to eq([%w{C00109 C00108}]*2) + end + it "should return periods defined in frame calendars" do + expect(frames.map(&:periods)).to eq([[period("2017-04-01", "2017-12-31")], [period("2017-03-01","2017-03-31")]]) + end + end + +end diff --git a/spec/models/api/v1/api_key_spec.rb b/spec/models/api/v1/api_key_spec.rb index 5f39a65e4..b700429d3 100644 --- a/spec/models/api/v1/api_key_spec.rb +++ b/spec/models/api/v1/api_key_spec.rb @@ -1,34 +1,25 @@ -describe Api::V1::ApiKey, :type => :model do +require 'rails_helper' - let(:referential){ create :referential } +RSpec.describe Api::V1::ApiKey, type: :model do + subject { create(:api_key) } - subject { described_class.create( :name => "test", :referential => referential)} + it { should validate_presence_of :organisation } - it "validity test" do - expect_it.to be_valid - expect(subject.referential).to eq(referential) + it 'should have a valid factory' do + expect(build(:api_key)).to be_valid end - context 'Creation' do - let( :name ){ SecureRandom.urlsafe_base64 } - - it 'can be created from a referential with a name, iff needed' do - # 1st time create a new record - expect{ described_class.from(referential, name: name) }.to change{ described_class.count }.by(1) - expect( described_class.last.attributes.values_at(*%w{referential_id name}) ).to eq([ - referential.id, name - ]) - - # 2nd time get the same record - expect{ described_class.from(referential, name: name) }.not_to change{ described_class.count } - expect( described_class.last.attributes.values_at(*%w{referential_id name}) ).to eq([ - referential.id, name - ]) + describe '#referential_from_token' do + it 'should return referential' do + referential = Api::V1::ApiKey.referential_from_token(subject.token) + expect(referential).to eq(subject.referential) end + end - it 'cannot be created without a referential' do - expect{ described_class.from(nil, name:name) rescue nil }.not_to change{ described_class.count } + describe '#organisation_from_token' do + it 'should return organisation' do + organisation = Api::V1::ApiKey.organisation_from_token(subject.token) + expect(organisation).to eq(subject.organisation) end end end - 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/company_spec.rb b/spec/models/chouette/company_spec.rb index 3da8b4311..a3101d79c 100644 --- a/spec/models/chouette/company_spec.rb +++ b/spec/models/chouette/company_spec.rb @@ -1,13 +1,8 @@ require 'spec_helper' describe Chouette::Company, :type => :model do - subject { create(:company) } - - it { is_expected.to validate_presence_of :name } - - # it { should validate_presence_of :objectid } - it { is_expected.to validate_uniqueness_of :objectid } + it { should validate_presence_of :name } describe "#nullables empty" do it "should set null empty nullable attributes" do 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/footnote_spec.rb b/spec/models/chouette/footnote_spec.rb index 98d751499..fc5e5f306 100644 --- a/spec/models/chouette/footnote_spec.rb +++ b/spec/models/chouette/footnote_spec.rb @@ -2,9 +2,21 @@ require 'spec_helper' describe Chouette::Footnote, type: :model do let(:footnote) { create(:footnote) } - it { should validate_presence_of :line } + describe 'data_source_ref' do + it 'should set default if omitted' do + expect(footnote.data_source_ref).to eq "DATASOURCEREF_EDITION_BOIV" + end + + it 'should not set default if not omitted' do + source = "RANDOM_DATASOURCE" + object = build(:footnote, data_source_ref: source) + object.save + expect(object.data_source_ref).to eq source + end + end + describe 'checksum' do it_behaves_like 'checksum support', :footnote diff --git a/spec/models/chouette/group_of_line_spec.rb b/spec/models/chouette/group_of_line_spec.rb index d49329118..29b4433c5 100644 --- a/spec/models/chouette/group_of_line_spec.rb +++ b/spec/models/chouette/group_of_line_spec.rb @@ -3,11 +3,7 @@ require 'spec_helper' describe Chouette::GroupOfLine, :type => :model do subject { create(:group_of_line) } - - it { is_expected.to validate_presence_of :name } - - # it { should validate_presence_of :objectid } - it { is_expected.to validate_uniqueness_of :objectid } + it { should validate_presence_of :name } describe "#stop_areas" do let!(:line){create(:line, :group_of_lines => [subject])} diff --git a/spec/models/chouette/network_spec.rb b/spec/models/chouette/network_spec.rb index c9e510e84..32bacc512 100644 --- a/spec/models/chouette/network_spec.rb +++ b/spec/models/chouette/network_spec.rb @@ -1,13 +1,8 @@ require 'spec_helper' describe Chouette::Network, :type => :model do - subject { create(:network) } - - it { is_expected.to validate_presence_of :name } - - # it { should validate_presence_of :objectid } - it { is_expected.to validate_uniqueness_of :objectid } + it { should validate_presence_of :name } describe "#stop_areas" do let!(:line){create(:line, :network => subject)} diff --git a/spec/models/chouette/route/route_base_spec.rb b/spec/models/chouette/route/route_base_spec.rb index c93b311ff..794da4f1b 100644 --- a/spec/models/chouette/route/route_base_spec.rb +++ b/spec/models/chouette/route/route_base_spec.rb @@ -7,7 +7,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/routing_constraint_zone_spec.rb b/spec/models/chouette/routing_constraint_zone_spec.rb index 054cfb9e6..c344642e6 100644 --- a/spec/models/chouette/routing_constraint_zone_spec.rb +++ b/spec/models/chouette/routing_constraint_zone_spec.rb @@ -3,7 +3,6 @@ require 'spec_helper' describe Chouette::RoutingConstraintZone, type: :model do subject { create(:routing_constraint_zone) } - let!(:routing_constraint_zone) { create(:routing_constraint_zone) } it { is_expected.to validate_presence_of :name } # shoulda matcher to validate length of array ? @@ -16,38 +15,38 @@ describe Chouette::RoutingConstraintZone, type: :model do describe 'validations' do it 'validates the presence of route_id' do expect { - routing_constraint_zone.update!(route_id: nil) + subject.update!(route_id: nil) }.to raise_error(NoMethodError) end it 'validates the presence of stop_point_ids' do expect { - routing_constraint_zone.update!(stop_point_ids: []) + subject.update!(stop_point_ids: []) }.to raise_error(ActiveRecord::RecordInvalid) end it 'validates that stop points belong to the route' do route = create(:route) expect { - routing_constraint_zone.update!(route_id: route.id) + subject.update!(route_id: route.id) }.to raise_error(ActiveRecord::RecordInvalid) end xit 'validates that not all stop points from the route are selected' do routing_constraint_zone.stop_points = routing_constraint_zone.route.stop_points expect { - routing_constraint_zone.save! + subject.save! }.to raise_error(ActiveRecord::RecordInvalid) end end describe 'deleted stop areas' do it 'does not have them in stop_area_ids' do - stop_point = routing_constraint_zone.route.stop_points.last - routing_constraint_zone.stop_points << stop_point - routing_constraint_zone.save! - routing_constraint_zone.route.stop_points.last.destroy! - expect(routing_constraint_zone.stop_points.map(&:id)).not_to include(stop_point.id) + stop_point = subject.route.stop_points.last + subject.stop_points << stop_point + subject.save! + subject.route.stop_points.last.destroy! + expect(subject.stop_points.map(&:id)).not_to include(stop_point.id) end end diff --git a/spec/models/chouette/stop_point_spec.rb b/spec/models/chouette/stop_point_spec.rb index d0314b8db..1be000b56 100644 --- a/spec/models/chouette/stop_point_spec.rb +++ b/spec/models/chouette/stop_point_spec.rb @@ -10,7 +10,7 @@ describe 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 c4eaeaaf0..761c39e5b 100644 --- a/spec/models/chouette/time_table_spec.rb +++ b/spec/models/chouette/time_table_spec.rb @@ -820,13 +820,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)) @@ -834,7 +834,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)) @@ -842,6 +842,207 @@ end end 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: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: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)) + expect(time_table.include_day?( Date.new(2013, 05, 27))).to eq(true) + end + 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: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: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 + end + 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: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)) + expect(time_table.include_in_periods?(Date.new(2012, 1, 2))).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: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( + :period_start => Date.new(2013, 05, 27), + :period_end => Date.new(2013, 05, 29)) + expect(time_table.include_in_periods?( excluded_date)).to be_falsey + end + 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: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)) + time_table.dates << Chouette::TimeTableDate.new( :date => Date.new(2012, 1, 2), :in_out => true) + 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: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)) + time_table.dates << Chouette::TimeTableDate.new( :date => Date.new(2012, 1, 2), :in_out => false) + expect(time_table.include_in_overlap_dates?(Date.new(2012, 1, 2))).to be_falsey + end + end + + describe "#dates" do + it "should have with position 0" do + expect(subject.dates.first.position).to eq(0) + end + context "when first date has been removed" do + before do + subject.dates.first.destroy + end + it "should begin with position 0" do + expect(subject.dates.first.position).to eq(0) + end + end + end + describe "#validity_out_between?" do + let(:empty_tm) {build(:time_table)} + it "should be false if empty calendar" do + expect(empty_tm.validity_out_between?( Date.today, Date.today + 7.day)).to be_falsey + end + it "should be true if caldendar is out during start_date and end_date period" do + start_date = subject.bounding_dates.max - 2.day + end_date = subject.bounding_dates.max + 2.day + expect(subject.validity_out_between?( start_date, end_date)).to be_truthy + end + it "should be false if calendar is out on start date" do + start_date = subject.bounding_dates.max + end_date = subject.bounding_dates.max + 2.day + expect(subject.validity_out_between?( start_date, end_date)).to be_falsey + end + it "should be false if calendar is out on end date" do + start_date = subject.bounding_dates.max - 2.day + end_date = subject.bounding_dates.max + expect(subject.validity_out_between?( start_date, end_date)).to be_truthy + end + it "should be false if calendar is out after start_date" do + start_date = subject.bounding_dates.max + 2.day + end_date = subject.bounding_dates.max + 4.day + expect(subject.validity_out_between?( start_date, end_date)).to be_falsey + end + end + describe "#validity_out_from_on?" do + let(:empty_tm) {build(:time_table)} + it "should be false if empty calendar" do + expect(empty_tm.validity_out_from_on?( Date.today)).to be_falsey + end + it "should be true if caldendar ends on expected date" do + expected_date = subject.bounding_dates.max + expect(subject.validity_out_from_on?( expected_date)).to be_truthy + end + it "should be true if calendar ends before expected date" do + expected_date = subject.bounding_dates.max + 30.day + expect(subject.validity_out_from_on?( expected_date)).to be_truthy + end + it "should be false if calendars ends after expected date" do + expected_date = subject.bounding_dates.max - 30.day + expect(subject.validity_out_from_on?( expected_date)).to be_falsey + end + end + describe "#bounding_dates" do + context "when timetable contains only periods" do + before do + subject.dates = [] + subject.save + end + it "should retreive periods.period_start.min and periods.period_end.max" do + expect(subject.bounding_dates.min).to eq(subject.periods.map(&:period_start).min) + expect(subject.bounding_dates.max).to eq(subject.periods.map(&:period_end).max) + end + end + context "when timetable contains only dates" do + before do + subject.periods = [] + subject.save + end + it "should retreive dates.min and dates.max" do + expect(subject.bounding_dates.min).to eq(subject.dates.map(&:date).min) + expect(subject.bounding_dates.max).to eq(subject.dates.map(&:date).max) + end + end + it "should contains min date" do + min_date = subject.bounding_dates.min + subject.dates.each do |tm_date| + expect(min_date <= tm_date.date).to be_truthy + end + subject.periods.each do |tm_period| + expect(min_date <= tm_period.period_start).to be_truthy + end + + end + it "should contains max date" do + max_date = subject.bounding_dates.max + subject.dates.each do |tm_date| + expect(tm_date.date <= max_date).to be_truthy + end + subject.periods.each do |tm_period| + expect(tm_period.period_end <= max_date).to be_truthy + end + + end + end + describe "#periods" do + it "should begin with position 0" do + expect(subject.periods.first.position).to eq(0) + end + context "when first period has been removed" do + before do + subject.periods.first.destroy + end + it "should begin with position 0" do + expect(subject.periods.first.position).to eq(0) + end + end + it "should have period_start before period_end" do + period = Chouette::TimeTablePeriod.new + period.period_start = Date.today + period.period_end = Date.today + 10 + expect(period.valid?).to be_truthy + end + it "should not have period_start after period_end" do + period = Chouette::TimeTablePeriod.new + period.period_start = Date.today + period.period_end = Date.today - 10 + expect(period.valid?).to be_falsey + end + it "should not have period_start equal to period_end" do + period = Chouette::TimeTablePeriod.new + period.period_start = Date.today + period.period_end = Date.today + expect(period.valid?).to be_falsey + end + end + # it { is_expected.to validate_presence_of :comment } # it { is_expected.to validate_uniqueness_of :objectid } @@ -964,7 +1165,6 @@ end target=subject.duplicate expect(target.id).to be_nil expect(target.comment).to eq(I18n.t("activerecord.copy", name: subject.comment)) - expect(target.objectid).to eq(subject.objectid+"_1") expect(target.int_day_types).to eq(subject.int_day_types) expect(target.dates.size).to eq(subject.dates.size) target.dates.each do |d| diff --git a/spec/models/chouette/trident_active_record_spec.rb b/spec/models/chouette/trident_active_record_spec.rb index 76544f85d..d5e30594d 100644 --- a/spec/models/chouette/trident_active_record_spec.rb +++ b/spec/models/chouette/trident_active_record_spec.rb @@ -1,119 +1,57 @@ require 'spec_helper' describe Chouette::TridentActiveRecord, :type => :model do - - it { expect(Chouette::TridentActiveRecord.ancestors).to include(Chouette::ActiveRecord) } - subject { create(:time_table) } - describe "#uniq_objectid" do + it { should validate_presence_of :objectid } + it { should validate_uniqueness_of :objectid } - it "should rebuild objectid" do - tm = create(:time_table) - tm.objectid = subject.objectid - tm.uniq_objectid - expect(tm.objectid).to eq(subject.objectid+"_1") - end + describe "#default_values" do + let(:object) { build(:time_table, objectid: nil) } - it "should rebuild objectid" do - tm = create(:time_table) - tm.objectid = subject.objectid - tm.uniq_objectid - tm.save - tm = create(:time_table) - tm.objectid = subject.objectid - tm.uniq_objectid - expect(tm.objectid).to eq(subject.objectid+"_2") + it 'should fill __pending_id__' do + object.default_values + expect(object.objectid.include?('__pending_id__')).to be_truthy end - end - def create_object(options = {}) - options = {name: "merge1"}.merge options - attributes = { comment: options[:name], objectid: options[:objectid] } - Chouette::TimeTable.new attributes - end - - describe "#prepare_auto_columns" do - - it "should left objectid" do - tm = create_object :objectid => "first:Timetable:merge1" - tm.prepare_auto_columns - expect(tm.objectid).to eq("first:Timetable:merge1") - end - - it "should add pending_id to objectid" do - tm = create_object - tm.prepare_auto_columns - expect(tm.objectid.start_with?("first:Timetable:__pending_id__")).to be_truthy - end - - it "should set id to objectid" do - tm = create_object - tm.save - expect(tm.objectid).to eq("first:Timetable:"+tm.id.to_s) - end + describe "#objectid" do + let(:object) { build(:time_table, objectid: nil) } - it "should detect objectid conflicts" do - tm = create_object - tm.save - tm.objectid = "first:Timetable:"+(tm.id+1).to_s - tm.save - tm = create_object - tm.save - expect(tm.objectid).to eq("first:Timetable:"+tm.id.to_s+"_1") + it 'should build objectid on create' do + object.save + id = "#{object.provider_id}:#{object.model_name}:#{object.local_id}:#{object.boiv_id}" + expect(object.objectid).to eq(id) end - end - - describe "objectid" do - - it "should build automatic objectid when empty" do - g1 = create_object - g1.save - expect(g1.objectid).to eq("first:Timetable:"+g1.id.to_s) + it 'should call build_objectid on after save' do + expect(object).to receive(:build_objectid) + object.save end - it "should build automatic objectid with fixed when only suffix given" do - g1 = create_object - g1.objectid = "toto" - g1.save - expect(g1.objectid).to eq("first:Timetable:toto") + it 'should not build new objectid is already set' do + id = "first:TimeTable:1-1:LOC" + object.objectid = id + object.save + expect(object.objectid).to eq(id) end - it "should build automatic objectid with extension when already exists" do - g1 = create_object - g1.save - cnt = g1.id + 1 - g1.objectid = "first:Timetable:"+cnt.to_s - g1.save - g2 = create_object - g2.save - expect(g2.objectid).to eq("first:Timetable:"+g2.id.to_s+"_1") + it 'should call default_values on create' do + expect(object).to receive(:default_values) + object.save end - it "should build automatic objectid with extension when already exists" do - g1 = create_object - g1.save - cnt = g1.id + 2 - g1.objectid = "first:Timetable:"+cnt.to_s - g1.save - g2 = create_object - g2.objectid = "first:Timetable:"+cnt.to_s+"_1" - g2.save - g3 = create_object - g3.save - expect(g3.objectid).to eq("first:Timetable:"+g3.id.to_s+"_2") + it 'should not call default_values on update' do + object = create(:time_table) + expect(object).to_not receive(:default_values) + object.touch end - it "should build automatic objectid when id cleared" do - g1 = create_object - g1.objectid = "first:Timetable:xxxx" - g1.save - g1.objectid = nil - g1.save - expect(g1.objectid).to eq("first:Timetable:"+g1.id.to_s) + it 'should create a new objectid when cleared' do + object.save + object.objectid = nil + object.save + expect(object.objectid).to be_truthy end end - end diff --git a/spec/models/compliance_check_result_spec.rb b/spec/models/compliance_check_result_spec.rb deleted file mode 100644 index 42a2e4507..000000000 --- a/spec/models/compliance_check_result_spec.rb +++ /dev/null @@ -1,100 +0,0 @@ -# require 'spec_helper' - -# describe ComplianceCheckResult, :type => :model do - -# subject { Factory( :compliance_check_result)} - -# describe "#indice" do -# context "when 1-NEPTUNE-XML-1 result" do -# before(:each) do -# subject.rule_code = "1-NEPTUNE-XML-1" -# end - -# describe '#indice' do -# subject { super().indice } -# it { is_expected.to eq(1) } -# end -# end -# context "when 2-NETEX-AccessLink-2 result" do -# before(:each) do -# subject.rule_code = "2-NETEX-AccessLink-2" -# end - -# describe '#indice' do -# subject { super().indice } -# it { is_expected.to eq(2) } -# end -# end -# end - -# describe "#data_type" do -# context "when 1-NEPTUNE-XML-1 result" do -# before(:each) do -# subject.rule_code = "1-NEPTUNE-XML-1" -# end - -# describe '#data_type' do -# subject { super().data_type } -# it { is_expected.to eq("XML") } -# end -# end -# context "when 2-NETEX-AccessLink-2 result" do -# before(:each) do -# subject.rule_code = "2-NETEX-AccessLink-2" -# end - -# describe '#data_type' do -# subject { super().data_type } -# it { is_expected.to eq("AccessLink") } -# end -# end -# end - -# describe "#format" do -# context "when 1-NEPTUNE-XML-1 result" do -# before(:each) do -# subject.rule_code = "1-NEPTUNE-XML-1" -# end - -# describe '#format' do -# subject { super().format } -# it { is_expected.to eq("NEPTUNE") } -# end -# end -# context "when 2-NETEX-AccessLink-2 result" do -# before(:each) do -# subject.rule_code = "2-NETEX-AccessLink-2" -# end - -# describe '#format' do -# subject { super().format } -# it { is_expected.to eq("NETEX") } -# end -# end -# end - -# describe "#level" do -# context "when 1-NEPTUNE-XML-1 result" do -# before(:each) do -# subject.rule_code = "1-NEPTUNE-XML-1" -# end - -# describe '#level' do -# subject { super().level } -# it { is_expected.to eq(1) } -# end -# end -# context "when 2-NEPTUNE-AccessLink-2 result" do -# before(:each) do -# subject.rule_code = "2-NEPTUNE-AccessLink-2" -# end - -# describe '#level' do -# subject { super().level } -# it { is_expected.to eq(2) } -# end -# end -# end - -# end - diff --git a/spec/models/compliance_check_task_spec.rb b/spec/models/compliance_check_task_spec.rb deleted file mode 100644 index a062fdb58..000000000 --- a/spec/models/compliance_check_task_spec.rb +++ /dev/null @@ -1,317 +0,0 @@ -# require 'spec_helper' - -# TODO: Can we get rid of this??? -# ************************* - -# describe ComplianceCheckTask, :type => :model do - -# subject { Factory( :compliance_check_task ) } - -# RSpec::Matchers.define :be_log_message do |expected| -# match do |actual| -# actual and expected.all? { |k,v| actual[k.to_s] == v } -# end -# end - - -# describe "#any_error_severity_failure?" do -# context "when compliance_check_results empty" do -# before(:each) do -# subject.compliance_check_results = [] -# end -# it "does return false" do -# expect(subject.any_error_severity_failure?).to be_falsey -# end -# end -# context "when compliance_check_results contains a error_severity_failure" do -# let( :valid_result){ Factory.build( :compliance_check_result) } -# let( :invalid_result){ Factory.build( :compliance_check_result, :severity => "error", :status => "nok") } -# before(:each) do -# subject.compliance_check_results = [ valid_result, invalid_result] -# end -# it "does return true" do -# expect(subject.any_error_severity_failure?).to be_truthy -# end -# end -# context "when compliance_check_results contains no error_severity_failure" do -# let( :valid_result){ Factory.build( :compliance_check_result) } -# before(:each) do -# subject.compliance_check_results = [ valid_result] -# end -# it "does return false" do -# expect(subject.any_error_severity_failure?).to be_falsey -# end -# end -# end - -# describe "#destroy" do -# let(:import_task){ Factory( :import_task )} -# context "with an import_task" do -# before(:each) do -# subject.import_task = import_task -# end -# it "should destroy import_task" do -# subject.destroy -# expect(ImportTask.exists?( import_task.id)).to be_falsey -# end -# end -# context "without any import_task" do -# before(:each) do -# subject.import_task = nil -# end -# it "should not raise exception" do -# subject.destroy -# expect(subject).to be_destroyed -# end -# end -# end - -# describe "#levels" do -# let(:import_task){ Factory( :import_task )} -# context "when validation is without import" do -# it "should not return levels 1 and 2" do -# expect(subject.levels.include?(1)).to be_falsey -# expect(subject.levels.include?(2)).to be_falsey -# end -# context "when parameter_set is defined" do -# before(:each) do -# subject.parameter_set = "dummy" -# end -# it "should return level 3" do -# expect(subject.levels.include?(3)).to be_truthy -# end -# end -# context "when parameter_set is not defined" do -# before(:each) do -# subject.parameter_set = nil -# end -# it "should not return level 3" do -# expect(subject.levels.include?(3)).not_to be_truthy -# end -# end -# end -# context "when validation is done with an import" do -# before(:each) do -# subject.import_task = import_task -# end -# it "should return levels 1 and 2" do -# expect(subject.levels.include?(1)).to be_truthy -# expect(subject.levels.include?(2)).to be_truthy -# end -# context "when parameter_set is defined" do -# before(:each) do -# subject.parameter_set = "dummy" -# end -# it "should return level 3" do -# expect(subject.levels.include?(3)).to be_truthy -# end -# end -# context "when parameter_set is not defined" do -# before(:each) do -# subject.parameter_set = nil -# end -# it "should not return level 3" do -# expect(subject.levels.include?(3)).not_to be_truthy -# end -# end -# end - -# end - -# describe "#chouette_command" do -# it "should be a Chouette::Command instance" do -# expect(subject.send( :chouette_command).class).to eq(Chouette::Command) -# end -# it "should have schema same as referential.slug" do -# expect(subject.send( :chouette_command).schema).to eq(subject.referential.slug) -# end -# end - -# describe "#validate" do -# let(:compliance_check_task){ Factory(:compliance_check_task) } -# let(:chouette_command) { "dummy" } -# context "for failing validation" do -# before(:each) do -# allow(chouette_command).to receive( :run!).and_raise( "dummy") -# allow(compliance_check_task).to receive_messages( :chouette_command => chouette_command) -# end -# it "should have status 'failed'" do -# compliance_check_task.validate -# expect(compliance_check_task.status).to eq("failed") -# end -# end -# context "for successful validation" do -# before(:each) do -# allow(compliance_check_task).to receive_messages( :chouette_command => double( :run! => true )) -# end -# it "should have status 'completed'" do -# compliance_check_task.validate -# expect(compliance_check_task.status).to eq("completed") -# end -# end -# end - -# describe "#validate" do -# let(:compliance_check_task){ Factory(:compliance_check_task) } -# let(:command_args){ "dummy" } -# before(:each) do -# allow(compliance_check_task).to receive_messages( :chouette_command => double( :run! => true )) -# allow(compliance_check_task).to receive_messages( :chouette_command_args => command_args) -# end -# it "should call chouette_command.run! with :c => 'import', :id => id" do -# expect(compliance_check_task.send( :chouette_command)).to receive( :run! ).with( command_args) -# compliance_check_task.validate -# end -# end - -# describe "#delayed_validate" do -# let( :import_task){ Factory.build(:import_task) } -# before(:each) do -# allow(subject).to receive_messages( :delay => double( :validate => true)) -# end -# it "should not call delay#validate if import_task defined" do -# subject.import_task = import_task -# expect(subject.delay).not_to receive( :validate) -# subject.delayed_validate -# end -# it "should call delay#validate if import_task blank" do -# subject.import_task = nil -# expect(subject.delay).to receive( :validate) -# subject.delayed_validate -# end - -# end - -# describe "#define_default_attributes" do -# it "should keep status if defined" do -# subject.status = "dummy" -# subject.define_default_attributes -# expect(subject.status).to eq("dummy") -# end -# it "should set status to pending if not defined" do -# subject.status = nil -# subject.define_default_attributes -# expect(subject.status).to eq("pending") -# end -# context "when rule_parameter_set is nil" do -# before(:each) do -# allow(subject).to receive_messages( :rule_parameter_set => nil) -# subject.parameter_set = "dummy" -# subject.parameter_set_name = "dummy" -# end -# it "should keep parameter_set_name" do -# subject.define_default_attributes -# expect(subject.parameter_set_name).to eq("dummy") -# end -# it "should keep parameter_set" do -# subject.define_default_attributes -# expect(subject.parameter_set).to eq("dummy") -# end -# end -# context "when rule_parameter_set is defined" do -# let( :rule_parameter_set ){ Factory( :rule_parameter_set ) } -# before(:each) do -# allow(subject).to receive_messages( :rule_parameter_set => rule_parameter_set) -# subject.parameter_set = "dummy" -# subject.parameter_set_name = "dummy" -# end -# it "should set parameter_set_name to rule_parameter_set.name" do -# subject.define_default_attributes -# expect(subject.parameter_set_name).to eq(rule_parameter_set.name) -# end -# it "should keep set parameter_set to rule_parameter_set.parameters" do -# subject.define_default_attributes -# expect(subject.parameter_set).to eq(rule_parameter_set.parameters) -# end -# end -# end - -# describe "#rule_parameter_set" do -# context "when rule_parameter_set_id is blank" do -# before(:each) do -# subject.rule_parameter_set_id = "" -# end -# it "should return nil" do -# expect(subject.rule_parameter_set).to be_nil -# end -# end -# context "when rule_parameter_set_id is not blank" do -# let( :rule_parameter_set ){ Factory( :rule_parameter_set ) } -# before(:each) do -# subject.rule_parameter_set_id = rule_parameter_set.id -# end -# it "should return rule_parameter_set instance" do -# expect(subject.rule_parameter_set).to eq(rule_parameter_set) -# end -# end -# end - -# describe "#rule_parameter_set_archived" do -# context "when parameter_set is blank" do -# before(:each) do -# subject.parameter_set = nil -# end -# it "should return nil" do -# expect(subject.rule_parameter_set_archived).to be_nil -# end -# end -# context "when parameter_set is blank" do -# before(:each) do -# subject.parameter_set = { :speed => 30, :distance => 5 } -# end -# it "should return RuleParameterSet#parameters same as parameter_set" do -# expect(subject.rule_parameter_set_archived.parameters).to eq(subject.parameter_set) -# end -# it "should return RuleParameterSet#name same as parameter_set_name" do -# expect(subject.rule_parameter_set_archived.name).to eq(subject.parameter_set_name) -# end -# end - -# end - -# # describe "#validate" do -# # -# # before(:each) do -# # subject.stub :validator => mock(:validate => true) -# # end -# # -# # it "should create a ComplianceCheckResult :started when started" do -# # subject.validate - # expect(subject.compliance_check_results.first).to be_log_message(:key => "started") -# # end -# # -# # it "should create a ComplianceCheckResult :completed when completed" do -# # subject.validate - # expect(subject.compliance_check_results.last).to be_log_message(:key => "completed") -# # end -# # -# # it "should create a ComplianceCheckResult :failed when failed" do -# # pending -# # # subject.loader.stub(:export).and_raise("export failed") -# # subject.validate - # expect(subject.compliance_check_results.last).to be_log_message(:key => "failed") -# # end -# # -# # end - -# describe ".create" do -# let( :new_compliance_check_task){ Factory.build( :compliance_check_task) } - -# it "should call #define_default_attributes" do -# expect(new_compliance_check_task).to receive( :define_default_attributes) -# new_compliance_check_task.save -# end - -# it "should call #delayed_validate" do -# expect(new_compliance_check_task).not_to receive( :delayed_validate) -# new_compliance_check_task.save -# end - -# end - -# it_behaves_like TypeIdsModelable do -# let(:type_ids_model) { subject} -# end - -# end - diff --git a/spec/models/concerns/error_format_spec.rb b/spec/models/concerns/error_format_spec.rb new file mode 100644 index 000000000..f82aecf44 --- /dev/null +++ b/spec/models/concerns/error_format_spec.rb @@ -0,0 +1,41 @@ +RSpec.describe ErrorFormat do + + context '#details' do + context 'are empty' do + it 'if no errors are present' do + expect( + described_class.details(build_stubbed(:referential)) + ).to be_empty + end + + it 'if no validation has been carried out' do + invalid = build_stubbed(:referential, name: nil) + expect( described_class.details(invalid) ).to be_empty + end + end + + context 'are not empty' do + it 'if an error is present and validation has been carried out' do + invalid = build_stubbed(:referential, name: nil) + expect( invalid ).not_to be_valid + expect( described_class.details(invalid) ).to eq({ + name: { error: 'doit être rempli(e)', value: nil } + }) + end + + it 'and can even hold many errors' do + create(:referential, name: 'hello') + invalid = build_stubbed( + :referential, + name: '', + slug: 'hello world' + ) + expect( invalid ).not_to be_valid + expect( described_class.details(invalid) ).to eq({ + name: { error: "doit être rempli(e)", value: '' }, + slug: { error: "n'est pas valide", value: 'hello world' } + }) + end + end + end +end diff --git a/spec/models/import_resource_spec.rb b/spec/models/import_resource_spec.rb index 99d260b20..c88bb5dd2 100644 --- a/spec/models/import_resource_spec.rb +++ b/spec/models/import_resource_spec.rb @@ -3,17 +3,17 @@ require 'rails_helper' RSpec.describe ImportResource, :type => :model do it { should belong_to(:import) } - it { should enumerize(:status).in(:new, :pending, :successful, :failed) } + it { should enumerize(:status).in("OK", "ERROR", "WARNING", "IGNORED") } it { should validate_presence_of(:name) } - it { should validate_presence_of(:type) } + it { should validate_presence_of(:resource_type) } it { should validate_presence_of(:reference) } describe 'states' do let(:import_resource) { create(:import_resource) } it 'should initialize with new state' do - expect(import_resource.new?).to be_truthy + expect(import_resource.status).to eq("WARNING") end end end diff --git a/spec/models/import_spec.rb b/spec/models/import_spec.rb index 164769fd5..cd5a30982 100644 --- a/spec/models/import_spec.rb +++ b/spec/models/import_spec.rb @@ -1,14 +1,14 @@ -RSpec.describe Import, :type => :model do +RSpec.describe Import, type: :model do it { should belong_to(:referential) } it { should belong_to(:workbench) } it { should belong_to(:parent) } - it { should enumerize(:status).in("aborted", "canceled", "failed", "new", "pending", "running", "successful") } + it { should enumerize(:status).in("aborted", "canceled", "failed", "new", "pending", "running", "successful", "warning") } it { should validate_presence_of(:file) } - it { should validate_presence_of(:referential) } it { should validate_presence_of(:workbench) } + it { should validate_presence_of(:creator) } let(:workbench_import) { build_stubbed(:workbench_import) } let(:workbench_import_with_completed_steps) do @@ -26,11 +26,41 @@ RSpec.describe Import, :type => :model do ) end + describe "#destroy" do + it "must destroy all child imports" do + workbench_import = create(:workbench_import) + create(:netex_import, parent: workbench_import) + + workbench_import.destroy + + expect(workbench_import).to be_destroyed + expect(NetexImport.count).to eq(0) + end + + it "must destroy all associated ImportMessages" do + import = create(:import) + create(:import_resource, import: import) + + import.destroy + + expect(ImportResource.count).to eq(0) + end + + it "must destroy all associated ImportResources" do + import = create(:import) + create(:import_message, import: import) + + import.destroy + + expect(ImportMessage.count).to eq(0) + end + end + describe "#notify_parent" do it "must call #child_change on its parent" do allow(netex_import).to receive(:update) - expect(workbench_import).to receive(:child_change).with(netex_import) + expect(workbench_import).to receive(:child_change) netex_import.notify_parent end @@ -49,110 +79,142 @@ RSpec.describe Import, :type => :model do end describe "#child_change" do + it "calls #update_status" do + allow(workbench_import).to receive(:update) + + expect(workbench_import).to receive(:update_status) + workbench_import.child_change + end + + it "calls #update_referentials" do + allow(workbench_import).to receive(:update) + + expect(workbench_import).to receive(:update_referentials) + workbench_import.child_change + end + end + + describe "#update_status" do shared_examples( - "updates :status to failed when child status indicates failure" + "updates :status to failed when >=1 child has failing status" ) do |failure_status| - it "updates :status to failed when child status indicates failure" do - allow(workbench_import).to receive(:update) - - netex_import = build_stubbed( + it "updates :status to failed when >=1 child has failing status" do + workbench_import = create(:workbench_import) + create( :netex_import, parent: workbench_import, status: failure_status ) - expect(workbench_import).to receive(:update).with(status: 'failed') + workbench_import.update_status - workbench_import.child_change(netex_import) + expect(workbench_import.status).to eq('failed') end end include_examples( - "updates :status to failed when child status indicates failure", + "updates :status to failed when >=1 child has failing status", "failed" ) include_examples( - "updates :status to failed when child status indicates failure", + "updates :status to failed when >=1 child has failing status", "aborted" ) include_examples( - "updates :status to failed when child status indicates failure", + "updates :status to failed when >=1 child has failing status", "canceled" ) - it "updates :status to successful when #ready?" do - expect(workbench_import).to receive(:update).with(status: 'successful') + it "updates :status to successful when all children are successful" do + workbench_import = create(:workbench_import) + create_list( + :netex_import, + 2, + parent: workbench_import, + status: 'successful' + ) + + workbench_import.update_status - workbench_import.child_change(netex_import) + expect(workbench_import.status).to eq('successful') end - it "updates :status to failed when #ready? and child is failed" do - netex_import = build_stubbed( + it "Updates :status to failed when any child has failed" do + workbench_import = create(:workbench_import) + [ + 'failed', + 'successful' + ].each do |status| + create( + :netex_import, + parent: workbench_import, + status: status + ) + end + + workbench_import.update_status + + expect(workbench_import.status).to eq('failed') + end + + it "updates :ended_at to now when status is finished" do + workbench_import = create(:workbench_import) + create( :netex_import, parent: workbench_import, - status: :failed + status: 'failed' ) - expect(workbench_import).to receive(:update).with(status: 'failed') + Timecop.freeze(Time.now) do + workbench_import.update_status + + expect(workbench_import.ended_at).to eq(Time.now) + end + end + end + + describe "#update_referentials" do + it "doesn't update referentials if parent status isn't finished" do + workbench_import = create(:workbench_import, status: 'pending') + netex_import = create(:netex_import, parent: workbench_import) + netex_import.referential.update(ready: false) + + workbench_import.update_referentials + netex_import.referential.reload - workbench_import.child_change(netex_import) + expect(netex_import.referential.ready).to be false end shared_examples( - "doesn't update :status if parent import status is finished" + "makes child referentials `ready` when status is finished" ) do |finished_status| - it "doesn't update :status if parent import status is finished" do - workbench_import = build_stubbed( - :workbench_import, - total_steps: 2, - current_step: 2, - status: finished_status - ) - child = double('Import') + it "makes child referentials `ready` when status is finished" do + workbench_import = create(:workbench_import, status: finished_status) + netex_import = create(:netex_import, parent: workbench_import) + netex_import.referential.update(ready: false) - expect(workbench_import).not_to receive(:update) + workbench_import.update_referentials + netex_import.referential.reload - workbench_import.child_change(child) + expect(netex_import.referential.ready).to be true end end include_examples( - "doesn't update :status if parent import status is finished", + "makes child referentials `ready` when status is finished", "successful" ) include_examples( - "doesn't update :status if parent import status is finished", + "makes child referentials `ready` when status is finished", "failed" ) include_examples( - "doesn't update :status if parent import status is finished", + "makes child referentials `ready` when status is finished", "aborted" ) include_examples( - "doesn't update :status if parent import status is finished", + "makes child referentials `ready` when status is finished", "canceled" ) end - - describe "#ready?" do - it "returns true if #current_step == #total_steps" do - import = build_stubbed( - :import, - total_steps: 4, - current_step: 4 - ) - - expect(import.ready?).to be true - end - - it "returns false if #current_step != #total_steps" do - import = build_stubbed( - :import, - total_steps: 6, - current_step: 3 - ) - - expect(import.ready?).to be false - end - end end diff --git a/spec/models/referential_metadata_spec.rb b/spec/models/referential_metadata_spec.rb index 91a2a7fc2..291ed974a 100644 --- a/spec/models/referential_metadata_spec.rb +++ b/spec/models/referential_metadata_spec.rb @@ -12,13 +12,13 @@ RSpec.describe ReferentialMetadata, :type => :model do describe ".new_from" do let(:referential_metadata) { create :referential_metadata, referential_source: create(:referential) } - let(:new_referential_metadata) { ReferentialMetadata.new_from(referential_metadata) } + let(:new_referential_metadata) { ReferentialMetadata.new_from(referential_metadata, []) } it "should not have an associated referential" do expect(new_referential_metadata).to be_a_new(ReferentialMetadata) end - it "should have the same lines" do + xit "should have the same lines" do expect(new_referential_metadata.lines).to eq(referential_metadata.lines) end @@ -30,8 +30,8 @@ RSpec.describe ReferentialMetadata, :type => :model do expect(new_referential_metadata.referential).to be(nil) end - it "should have the same referential_source" do - expect(new_referential_metadata.referential_source).to eq(referential_metadata.referential_source) + it "should have the right referential_source" do + expect(new_referential_metadata.referential_source).to eq(referential_metadata.referential) end end diff --git a/spec/models/referential_spec.rb b/spec/models/referential_spec.rb index 53eaa60a3..f9ace08cc 100644 --- a/spec/models/referential_spec.rb +++ b/spec/models/referential_spec.rb @@ -27,20 +27,21 @@ describe Referential, :type => :model do context "Cloning referential" do let(:clone) do - Referential.new_from(ref) + Referential.new_from(ref, []) end - let(:saved_clone) do - clone.tap do |clone| - clone.organisation = ref.organisation - clone.metadatas.each do |metadata| - metadata.periodes = metadata.periodes.map { |period| Range.new(period.end+1, period.end+10) } - end - clone.save! - end - end - - it 'should create a ReferentialCloning' do + # let(:saved_clone) do + # clone.tap do |clone| + # clone.organisation = ref.organisation + # clone.metadatas.each do |metadata| + # metadata.line_ids = ref.lines.where(id: clone.line_ids, objectid: JSON.parse(ref.organisation.sso_attributes["functional_scope"]).collect(&:id) + # metadata.periodes = metadata.periodes.map { |period| Range.new(period.end+1, period.end+10) } + # end + # clone.save! + # end + # end + + xit 'should create a ReferentialCloning' do expect { saved_clone }.to change{ReferentialCloning.count}.by(1) end @@ -48,7 +49,7 @@ describe Referential, :type => :model do referential.metadatas.map { |m| [ m.periodes, m.line_ids ] } end - it 'should clone referential_metadatas' do + xit 'should clone referential_metadatas' do expect(metadatas_attributes(clone)).to eq(metadatas_attributes(ref)) end end diff --git a/spec/models/vehicle_journey_export_spec.rb b/spec/models/vehicle_journey_export_spec.rb index 6252a73f9..83b3bbb04 100644 --- a/spec/models/vehicle_journey_export_spec.rb +++ b/spec/models/vehicle_journey_export_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' describe VehicleJourneyExport, :type => :model do - + let!(:line) { create(:line) } let!(:route) { create(:route, :line => line) } let!(:other_route) { create(:route, :line => line) } @@ -10,10 +10,10 @@ describe VehicleJourneyExport, :type => :model do let!(:journey_pattern) { create(:journey_pattern, :route => route) } let!(:other_journey_pattern) { create(:journey_pattern_even, :route => route) } - let!(:vehicle_journey1) { create(:vehicle_journey_common, :objectid => "export:VehicleJourney:1", :route_id => route.id, :journey_pattern_id => journey_pattern.id) } - let!(:vehicle_journey2) { create(:vehicle_journey_common, :objectid => "export:VehicleJourney:2", :route_id => route.id, :journey_pattern_id => other_journey_pattern.id) } - let!(:vehicle_journey3) { create(:vehicle_journey_common, :objectid => "export:VehicleJourney:3", :route_id => route.id, :journey_pattern_id => journey_pattern.id) } - + let!(:vehicle_journey1) { create(:vehicle_journey_common, :objectid => "export:VehicleJourney:1:loc", :route_id => route.id, :journey_pattern_id => journey_pattern.id) } + let!(:vehicle_journey2) { create(:vehicle_journey_common, :objectid => "export:VehicleJourney:2:loc", :route_id => route.id, :journey_pattern_id => other_journey_pattern.id) } + let!(:vehicle_journey3) { create(:vehicle_journey_common, :objectid => "export:VehicleJourney:3:loc", :route_id => route.id, :journey_pattern_id => journey_pattern.id) } + let!(:stop_point0) { route.stop_points[0] } let!(:stop_point1) { route.stop_points[1] } let!(:stop_point2) { route.stop_points[2] } @@ -21,10 +21,10 @@ describe VehicleJourneyExport, :type => :model do let!(:stop_point4) { route.stop_points[4] } let!(:time_table) { create(:time_table)} - - subject { VehicleJourneyExport.new(:vehicle_journeys => route.vehicle_journeys, :route => route) } - describe ".tt_day_types" do + subject { VehicleJourneyExport.new(:vehicle_journeys => route.vehicle_journeys, :route => route) } + + describe ".tt_day_types" do it "should return no day_type" do time_table.int_day_types = 0 @@ -35,10 +35,10 @@ describe VehicleJourneyExport, :type => :model do time_table.int_day_types = 4|8|16|32|64|128|256 expect(subject.tt_day_types(time_table)).to eq("LuMaMeJeVeSaDi") end - + end - describe ".tt_periods" do + describe ".tt_periods" do it "should return empty period" do time_table.periods.clear @@ -50,10 +50,10 @@ describe VehicleJourneyExport, :type => :model do time_table.periods << Chouette::TimeTablePeriod.new(:period_start => Date.new(2014,8,1), :period_end => Date.new(2014,8,8)) expect(subject.tt_periods(time_table)).to eq("[2014-08-01 -> 2014-08-08] ") end - + end - - describe ".tt_included_days" do + + describe ".tt_included_days" do it "should return empty included dates" do time_table.dates.clear @@ -65,10 +65,10 @@ describe VehicleJourneyExport, :type => :model do time_table.dates << Chouette::TimeTableDate.new(:date => Date.new(2014,8,1), :in_out => true) expect(subject.tt_peculiar_days(time_table)).to eq("2014-08-01 ") end - + end - describe ".tt_excluded_days" do + describe ".tt_excluded_days" do it "should return empty excluded dates" do time_table.dates.clear @@ -80,7 +80,7 @@ describe VehicleJourneyExport, :type => :model do time_table.dates << Chouette::TimeTableDate.new(:date => Date.new(2014,8,1), :in_out => false) expect(subject.tt_excluded_days(time_table)).to eq("2014-08-01 ") end - + end - + end diff --git a/spec/models/vehicle_journey_import_spec.rb b/spec/models/vehicle_journey_import_spec.rb index b01523dd9..7b31dc806 100644 --- a/spec/models/vehicle_journey_import_spec.rb +++ b/spec/models/vehicle_journey_import_spec.rb @@ -36,9 +36,9 @@ describe VehicleJourneyImport, :type => :model do let!(:journey_pattern) { create(:journey_pattern, :route => route) } let!(:other_journey_pattern) { create(:journey_pattern_even, :route => route) } - let!(:vehicle_journey1) { create(:vehicle_journey_common, :objectid => "import:VehicleJourney:1", :route_id => route.id, :journey_pattern_id => journey_pattern.id) } - let!(:vehicle_journey2) { create(:vehicle_journey_common, :objectid => "import:VehicleJourney:2", :route_id => route.id, :journey_pattern_id => other_journey_pattern.id) } - let!(:vehicle_journey3) { create(:vehicle_journey_common, :objectid => "import:VehicleJourney:3", :route_id => route.id, :journey_pattern_id => journey_pattern.id) } + let!(:vehicle_journey1) { create(:vehicle_journey_common, :objectid => "import:VehicleJourney:1:loc", :route_id => route.id, :journey_pattern_id => journey_pattern.id) } + let!(:vehicle_journey2) { create(:vehicle_journey_common, :objectid => "import:VehicleJourney:2:loc", :route_id => route.id, :journey_pattern_id => other_journey_pattern.id) } + let!(:vehicle_journey3) { create(:vehicle_journey_common, :objectid => "import:VehicleJourney:3:loc", :route_id => route.id, :journey_pattern_id => journey_pattern.id) } let!(:stop_point0) { route.stop_points[0] } let!(:stop_point1) { route.stop_points[1] } @@ -86,7 +86,7 @@ describe VehicleJourneyImport, :type => :model do expect(Chouette::VehicleJourneyAtStop.all.size).to eq(17) end - it "should not import vehicle_journeys and not create objects when vehicle journey at stops are not in ascendant order", :skip => "Time gap validation is in pending status" do + it "should not import vehicle_journeys and not create objects when vehicle journey at stops are not in ascendant order", :skip => "Time gap validation is in pending status" do expect(VehicleJourneyImport.new(:route => route, :file => invalid_file_on_vjas_object).save).to be_falsey expect(Chouette::VehicleJourney.all.size).to eq(3) expect(Chouette::VehicleJourneyAtStop.all.size).to eq(0) diff --git a/spec/models/vehicle_translation_spec.rb b/spec/models/vehicle_translation_spec.rb index c9a573ae2..d30cfa03e 100644 --- a/spec/models/vehicle_translation_spec.rb +++ b/spec/models/vehicle_translation_spec.rb @@ -6,7 +6,6 @@ describe VehicleTranslation, :type => :model do # To fix : need to comment :company => company # after adding company to apartment excluded models let!(:vehicle_journey){ create(:vehicle_journey, - :objectid => "dummy", :journey_pattern => journey_pattern, :route => journey_pattern.route, # :company => company, diff --git a/spec/policies/api_key_policy_spec.rb b/spec/policies/api_key_policy_spec.rb new file mode 100644 index 000000000..5b9d59fa3 --- /dev/null +++ b/spec/policies/api_key_policy_spec.rb @@ -0,0 +1,28 @@ +require 'rails_helper' + +RSpec.describe ApiKeyPolicy do + + let(:user) { User.new } + + subject { described_class } + + permissions ".scope" do + pending "add some examples to (or delete) #{__FILE__}" + end + + permissions :show? do + pending "add some examples to (or delete) #{__FILE__}" + end + + permissions :create? do + pending "add some examples to (or delete) #{__FILE__}" + end + + permissions :update? do + pending "add some examples to (or delete) #{__FILE__}" + end + + permissions :destroy? do + pending "add some examples to (or delete) #{__FILE__}" + end +end diff --git a/spec/requests/api/v1/netex_import_spec.rb b/spec/requests/api/v1/netex_import_spec.rb index fd5f6d497..b6728168e 100644 --- a/spec/requests/api/v1/netex_import_spec.rb +++ b/spec/requests/api/v1/netex_import_spec.rb @@ -4,7 +4,7 @@ RSpec.describe "NetexImport", type: :request do let( :referential ){ create :referential } let( :workbench ){ referential.workbench } - + let( :workbench_import ){ create :workbench_import } let( :file_path ){ fixtures_path 'single_reference_import.zip' } let( :file ){ fixture_file_upload( file_path ) } @@ -19,42 +19,59 @@ RSpec.describe "NetexImport", type: :request do let( :legal_attributes ) do { - name: 'hello world', + name: 'offre1', file: file, - workbench_id: workbench.id + workbench_id: workbench.id, + parent_id: workbench_import.id, + parent_type: workbench_import.class.name } - end + end context 'with correct credentials and correct request' do let( :authorization ){ authorization_token_header( get_api_key.token ) } - + #TODO Check why referential_id is nil it 'succeeds' do - post_request.(netex_import: legal_attributes) - expect( response ).to be_success - expect( json_response_body ).to eq( - 'id' => NetexImport.last.id, - 'referential_id' => Referential.last.id, - 'workbench_id' => workbench.id - ) + skip "Problem with referential_id" do + create(:line, objectid: 'STIF:CODIFLIGNE:Line:C00108', line_referential: workbench.line_referential) + create(:line, objectid: 'STIF:CODIFLIGNE:Line:C00109', line_referential: workbench.line_referential) + + post_request.(netex_import: legal_attributes) + expect( response ).to be_success + expect( json_response_body ).to eq( + 'id' => NetexImport.last.id, + 'referential_id' => Referential.last.id, + 'workbench_id' => workbench.id + ) + end end + it 'creates a NetexImport object in the DB' do + create(:line, objectid: 'STIF:CODIFLIGNE:Line:C00108', line_referential: workbench.line_referential) + create(:line, objectid: 'STIF:CODIFLIGNE:Line:C00109', line_referential: workbench.line_referential) + expect{ post_request.(netex_import: legal_attributes) }.to change{NetexImport.count}.by(1) end + #TODO Check why Referential count does not change it 'creates a correct Referential' do - legal_attributes # force object creation for correct to change behavior - expect{post_request.(netex_import: legal_attributes)}.to change{Referential.count}.by(1) - Referential.last.tap do | ref | - expect( ref.workbench_id ).to eq(workbench.id) - expect( ref.organisation_id ).to eq(workbench.organisation_id) + skip "Referential count does not change" do + create(:line, objectid: 'STIF:CODIFLIGNE:Line:C00108', line_referential: workbench.line_referential) + create(:line, objectid: 'STIF:CODIFLIGNE:Line:C00109', line_referential: workbench.line_referential) + + legal_attributes # force object creation for correct to change behavior + expect{post_request.(netex_import: legal_attributes)}.to change{Referential.count}.by(1) + Referential.last.tap do | ref | + expect( ref.workbench_id ).to eq(workbench.id) + expect( ref.organisation_id ).to eq(workbench.organisation_id) + end end end end - context 'with incorrect credentials and correct request' do + context 'with incorrect credentials and correct request', pending: "see #4311" do let( :authorization ){ authorization_token_header( "#{referential.id}-incorrect_token") } it 'does not create any DB object and does not succeed' do @@ -68,10 +85,14 @@ RSpec.describe "NetexImport", type: :request do context 'with correct credentials and incorrect request' do let( :authorization ){ authorization_token_header( get_api_key.token ) } - shared_examples_for 'illegal attributes' do |bad_attribute, illegal_value=nil, referential_count: 0| + shared_examples_for 'illegal attributes' do |bad_attribute, illegal_value=nil| context "missing #{bad_attribute}" do let!( :illegal_attributes ){ legal_attributes.merge( bad_attribute => illegal_value ) } it 'does not succeed' do + # TODO: Handle better when `ReferentialMetadataKludge` is reworked + create(:line, objectid: 'STIF:CODIFLIGNE:Line:C00108') + create(:line, objectid: 'STIF:CODIFLIGNE:Line:C00109') + post_request.(netex_import: illegal_attributes) expect( response.status ).to eq(406) expect( json_response_body['errors'][bad_attribute.to_s] ).not_to be_empty @@ -81,20 +102,22 @@ RSpec.describe "NetexImport", type: :request do expect{ post_request.(netex_import: illegal_attributes) }.not_to change{Import.count} end - it 'might create a referential' do - expect{ post_request.(netex_import: illegal_attributes) }.to change{Referential.count}.by(referential_count) + it 'might not create a referential' do + expect{ post_request.(netex_import: illegal_attributes) }.not_to change{Referential.count} end end end - it_behaves_like 'illegal attributes', :file, referential_count: 1 + it_behaves_like 'illegal attributes', :file it_behaves_like 'illegal attributes', :workbench_id - context 'name already taken' do - before do - create :referential, name: 'already taken' - end - it_behaves_like 'illegal attributes', :name, 'already taken' - end + + # TODO Create a specific test when referential is not created + # context 'name already taken' do + # before do + # create :referential, name: 'already taken' + # end + # it_behaves_like 'illegal attributes', name: 'already taken' + # end end end end diff --git a/spec/services/http_service_spec.rb b/spec/services/http_service_spec.rb index 8c8af480c..25cc1ee35 100644 --- a/spec/services/http_service_spec.rb +++ b/spec/services/http_service_spec.rb @@ -33,9 +33,6 @@ RSpec.describe HTTPService do let( :upload_list ){ [value, mime_type, as_name] } it 'sets authorization and posts data' do - expect(Faraday::UploadIO).to receive(:new).with(*upload_list).and_return upload_io - expect(params).to receive(:update).with(name => upload_io) - expect(Faraday).to receive(:new).with(url: host).and_yield(faraday_connection) expect(faraday_connection).to receive(:adapter).with(Faraday.default_adapter) expect(faraday_connection).to receive(:headers).and_return headers diff --git a/spec/services/retry_service_spec.rb b/spec/services/retry_service_spec.rb deleted file mode 100644 index bb3416373..000000000 --- a/spec/services/retry_service_spec.rb +++ /dev/null @@ -1,137 +0,0 @@ -RSpec.describe RetryService do - subject { described_class.new delays: [2, 3], rescue_from: [NameError, ArgumentError] } - - context 'no retry necessary' do - before do - expect( subject ).not_to receive(:sleep) - end - - it 'returns an ok result' do - expect( subject.execute { 42 } ).to eq(Result.ok(42)) - end - it 'does not fail on nil' do - expect( subject.execute { nil } ).to eq(Result.ok(nil)) - end - - it 'fails wihout retries if raising un unregistered exception' do - expect{ subject.execute{ raise KeyError } }.to raise_error(KeyError) - end - - end - - context 'all retries fail' do - before do - expect( subject ).to receive(:sleep).with(2) - expect( subject ).to receive(:sleep).with(3) - end - it 'fails after raising a registered exception n times' do - result = subject.execute{ raise ArgumentError } - expect( result.status ).to eq(:error) - expect( result.value ).to be_kind_of(ArgumentError) - end - it 'fails with an explicit try again (automatically registered exception)' do - result = subject.execute{ raise RetryService::Retry } - expect( result.status ).to eq(:error) - expect( result.value ).to be_kind_of(RetryService::Retry) - end - end - - context "if at first you don't succeed" do - before do - @count = 0 - expect( subject ).to receive(:sleep).with(2) - end - - it 'succeeds the second time' do - expect( subject.execute{ succeed_later(ArgumentError){ 42 } } ).to eq(Result.ok(42)) - end - - it 'succeeds the second time with try again (automatically registered exception)' do - expect( subject.execute{ succeed_later(RetryService::Retry){ 42 } } ).to eq(Result.ok(42)) - end - end - - context 'last chance' do - before do - @count = 0 - expect( subject ).to receive(:sleep).with(2) - expect( subject ).to receive(:sleep).with(3) - end - it 'succeeds the third time with try again (automatically registered exception)' do - result = subject.execute{ succeed_later(RetryService::Retry, count: 2){ 42 } } - expect( result ).to eq( Result.ok(42) ) - end - end - - context 'failure callback once' do - subject do - described_class.new delays: [2, 3], rescue_from: [NameError, ArgumentError] do |reason, count| - @reason=reason - @callback_count=count - @failures += 1 - end - end - - before do - @failures = 0 - @count = 0 - expect( subject ).to receive(:sleep).with(2) - end - - it 'succeeds the second time and calls the failure_callback once' do - subject.execute{ succeed_later(RetryService::Retry){ 42 } } - expect( @failures ).to eq(1) - end - it '... and the failure is passed into the callback' do - subject.execute{ succeed_later(RetryService::Retry){ 42 } } - expect( @reason ).to be_a(RetryService::Retry) - expect( @callback_count ).to eq(1) - end - end - - context 'failure callback twice' do - subject do - described_class.new delays: [2, 3], rescue_from: [NameError, ArgumentError] do |_reason, _count| - @failures += 1 - end - end - - before do - @failures = 0 - @count = 0 - expect( subject ).to receive(:sleep).with(2) - expect( subject ).to receive(:sleep).with(3) - end - - it 'succeeds the third time and calls the failure_callback twice' do - subject.execute{ succeed_later(NameError, count: 2){ 42 } } - expect( @failures ).to eq(2) - end - end - - context 'failure callback in constructor' do - subject do - described_class.new(delays: [1, 2], &method(:add2failures)) - end - before do - @failures = [] - @count = 0 - expect( subject ).to receive(:sleep).with(1) - expect( subject ).to receive(:sleep).with(2) - end - it 'succeeds the second time and calls the failure_callback once' do - subject.execute{ succeed_later(RetryService::Retry, count: 2){ 42 } } - expect( @failures ).to eq([1,2]) - end - end - - def add2failures( e, c) - @failures << c - end - - def succeed_later error, count: 1, &blk - return blk.() unless @count < count - @count += 1 - raise error, 'error' - end -end diff --git a/spec/services/zip_service/regression_4273_spec.rb b/spec/services/zip_service/regression_4273_spec.rb new file mode 100644 index 000000000..4fe0f6539 --- /dev/null +++ b/spec/services/zip_service/regression_4273_spec.rb @@ -0,0 +1,59 @@ +RSpec.describe ZipService do + describe 'Regression Issue # 4273 https://projects.af83.io/issues/4273' do + let( :zip_service ){ described_class } + let( :unzipper ){ zip_service.new(zip_data) } + let( :zip_data ){ File.read zip_file } + + context 'real test data' do + let( :subdir_names ){ %w<OFFRE_TRANSDEV_20170301122517 OFFRE_TRANSDEV_20170301122519> } + let( :expected_chksums ){ + checksum_trees( subdir_names.map{ |sn| subdir_file(sn, prefix: 'source_') } ) + } + + let( :zip_file ){ fixtures_path 'OFFRE_TRANSDEV_2017030112251.zip' } + # + # Remove potential test artefacts + before do + subdir_names.each do | subdir_name | + File.unlink( subdir_file subdir_name, suffix: '.zip' ) rescue nil + Dir.unlink( subdir_file subdir_name ) rescue nil + end + end + + it "yields the correct content" do + subdir_contents = {} + # Write ZipService Streams to files and inflate them to file system + unzipper.subdirs.each do | subdir | + File.open(subdir_file( subdir.name, suffix: '.zip' ), 'wb'){ |f| f.write subdir.stream.string } + unzip_subdir subdir + end + # Represent the inflated file_system as a checksum tree + actual_checksums = + checksum_trees( subdir_names.map{ |sn| subdir_file(sn, prefix: 'target/') } ) + expect( actual_checksums ).to eq( expected_chksums ) + end + + end + + end + + def checksum_trees *dirs + dirs.flatten.inject({},&method(:checksum_tree)) + end + def checksum_tree repr, dir + Dir.glob("#{dir}/**/*").each do |file| + if !File.directory?(file) + repr.merge!( File.basename(file) => %x{cksum #{file}}.split.first ){ |_, ov, nv| Array(ov) << nv } + end + end + repr + end + + def subdir_file( subdir, prefix: 'target_', suffix: '' ) + fixtures_path("#{prefix}#{subdir}#{suffix}") + end + + def unzip_subdir subdir + %x{unzip -oqq #{subdir_file subdir.name, suffix: '.zip'} -d #{fixture_path}/target} + end +end diff --git a/spec/services/zip_service/zip_entry_data_spec.rb b/spec/services/zip_service/zip_entry_data_spec.rb deleted file mode 100644 index 2a7226eb4..000000000 --- a/spec/services/zip_service/zip_entry_data_spec.rb +++ /dev/null @@ -1,32 +0,0 @@ -RSpec.describe ZipService do - - subject{ described_class.new(read_fixture('multiple_references_import.zip')) } - - it 'can group all entries' do - expect( subject.entry_groups.keys ).to eq(%w{ref1 ref2}) - end - - context 'creates correct zip data for each subdir' do - it 'e.g. reference1' do - reference1_stream = subject.entry_group_streams['ref1'] - control_stream = Zip::InputStream.open( reference1_stream ) - control_entries = described_class.entries(control_stream) - expect( control_entries.map{ |e| [e.name, e.get_input_stream.read]}.force ).to eq([ - ["multiref/ref1/", ""], - ["multiref/ref1/datum-1", "multi-ref1-datum1\n"], - ["multiref/ref1/datum-2", "multi-ref1-datum2\n"] - ]) - end - it 'e.g. reference2' do - reference2_stream = subject.entry_group_streams['ref2'] - control_stream = Zip::InputStream.open( reference2_stream ) - control_entries = described_class.entries(control_stream) - expect( control_entries.map{ |e| [e.name, e.get_input_stream.read]}.force ).to eq([ - ["multiref/ref2/", ""], - ["multiref/ref2/datum-1", "multi-ref2-datum1\n"], - ["multiref/ref2/datum-2", "multi-ref2-datum2\n"] - ]) - end - end - -end diff --git a/spec/services/zip_service/zip_entry_dirs_spec.rb b/spec/services/zip_service/zip_entry_dirs_spec.rb deleted file mode 100644 index 8ca1b0f1a..000000000 --- a/spec/services/zip_service/zip_entry_dirs_spec.rb +++ /dev/null @@ -1,33 +0,0 @@ -RSpec.describe ZipService do - - let( :zip_service ){ described_class } - - let( :zip_data ){ File.read zip_file } - - shared_examples_for 'a correct zip entry reader' do - it 'gets all entries of the zip file' do - expect( zip_service.new(zip_data).entry_groups.keys ).to eq(expected) - end - end - - context 'single entry' do - let( :zip_file ){ fixtures_path 'multiple_references_import.zip' } - let( :expected ){ %w{ref1 ref2} } - - it_behaves_like 'a correct zip entry reader' - end - - context 'more entries' do - let( :zip_file ){ fixtures_path 'single_reference_import.zip' } - let( :expected ){ %w{ref} } - - it_behaves_like 'a correct zip entry reader' - end - - context 'illegal file' do - let( :zip_file ){ fixtures_path 'nozip.zip' } - let( :expected ){ [] } - - it_behaves_like 'a correct zip entry reader' - end -end diff --git a/spec/services/zip_service/zip_output_streams_spec.rb b/spec/services/zip_service/zip_output_streams_spec.rb deleted file mode 100644 index 742f9b996..000000000 --- a/spec/services/zip_service/zip_output_streams_spec.rb +++ /dev/null @@ -1,8 +0,0 @@ -RSpec.describe ZipService do - - subject{ described_class.new(read_fixture('multiple_references_import.zip')) } - - it "exposes its size" do - expect( subject.entry_group_streams.size ).to eq(2) - end -end diff --git a/spec/support/api_key.rb b/spec/support/api_key.rb index 561e1f796..cc08cd7f1 100644 --- a/spec/support/api_key.rb +++ b/spec/support/api_key.rb @@ -5,20 +5,24 @@ module ApiKeyHelper end def get_api_key - Api::V1::ApiKey.first_or_create( :referential_id => referential.id, :name => "test") + Api::V1::ApiKey.first_or_create(referential: referential, organisation: organisation) end + def config_formatted_request_with_authorization( format) request.env['HTTP_AUTHORIZATION'] = ActionController::HttpAuthentication::Token.encode_credentials( get_api_key.token) request.accept = format end + def config_formatted_request_with_dummy_authorization( format) request.env['HTTP_AUTHORIZATION'] = ActionController::HttpAuthentication::Token.encode_credentials( "dummy") request.accept = format end + def config_formatted_request_without_authorization( format) request.env['HTTP_AUTHORIZATION'] = nil request.accept = format end + def json_xml_format? request.accept == "application/json" || request.accept == "application/xml" end diff --git a/spec/support/devise.rb b/spec/support/devise.rb index 46249fef2..c9fd1b8e5 100644 --- a/spec/support/devise.rb +++ b/spec/support/devise.rb @@ -3,10 +3,10 @@ module DeviseRequestHelper def login_user organisation = Organisation.where(:code => "first").first_or_create(attributes_for(:organisation)) - @user ||= + @user ||= create(:user, :organisation => organisation, - :permissions => Support::Permissions.all_permissions) + :permissions => Support::Permissions.all_permissions) login_as @user, :scope => :user # post_via_redirect user_session_path, 'user[email]' => @user.email, 'user[password]' => @user.password diff --git a/spec/support/referential.rb b/spec/support/referential.rb index 57b510f69..c431856b8 100644 --- a/spec/support/referential.rb +++ b/spec/support/referential.rb @@ -12,6 +12,7 @@ module ReferentialHelper base.class_eval do extend ClassMethods alias_method :referential, :first_referential + alias_method :organisation, :first_organisation end end diff --git a/spec/support/shared_context.rb b/spec/support/shared_context.rb new file mode 100644 index 000000000..e9b0025a2 --- /dev/null +++ b/spec/support/shared_context.rb @@ -0,0 +1,15 @@ +shared_context 'iboo authenticated api user' do + let(:api_key) { create(:api_key, organisation: organisation) } + + before do + request.env['HTTP_AUTHORIZATION'] = ActionController::HttpAuthentication::Basic.encode_credentials(api_key.organisation.code, api_key.token) + end +end + +shared_context 'iboo wrong authorisation api user' do + let(:api_key) { create(:api_key, organisation: organisation) } + + before do + request.env['HTTP_AUTHORIZATION'] = ActionController::HttpAuthentication::Basic.encode_credentials('fake code', api_key.token) + end +end diff --git a/spec/workers/referential_cloning_worker_spec.rb b/spec/workers/referential_cloning_worker_spec.rb index 52ed8913b..7e4a2357a 100644 --- a/spec/workers/referential_cloning_worker_spec.rb +++ b/spec/workers/referential_cloning_worker_spec.rb @@ -3,7 +3,7 @@ require 'ostruct' RSpec.describe ReferentialCloningWorker do - context "given a refererntial cloning" do + context "given a referential cloning" do let( :id ){ double } @@ -34,4 +34,20 @@ RSpec.describe ReferentialCloningWorker do end end + it "should clone an existing Referential" do + source_referential = create :referential + + source_referential.switch + source_time_table = create :time_table + + target_referential = create :referential, created_from: source_referential + + cloning = ReferentialCloning.create source_referential: source_referential, target_referential: target_referential + ReferentialCloningWorker.new.perform(cloning) + + target_referential.switch + expect(Chouette::TimeTable.where(objectid: source_time_table.objectid).exists?) + end + + end diff --git a/spec/workers/workbench_import_worker_spec.rb b/spec/workers/workbench_import_worker_spec.rb index b719cbb98..a349b3433 100644 --- a/spec/workers/workbench_import_worker_spec.rb +++ b/spec/workers/workbench_import_worker_spec.rb @@ -6,11 +6,6 @@ RSpec.describe WorkbenchImportWorker, type: [:worker, :request] do let( :workbench ){ import.workbench } let( :referential ){ import.referential } let( :api_key ){ build_stubbed :api_key, referential: referential, token: "#{referential.id}-#{SecureRandom.hex}" } - let( :params ) do - { netex_import: - { referential_id: referential.id, workbench_id: workbench.id } - } - end # http://www.example.com/workbenches/:workbench_id/imports/:id/download let( :host ){ Rails.configuration.rails_host } @@ -23,12 +18,12 @@ RSpec.describe WorkbenchImportWorker, type: [:worker, :request] do let( :upload_path ) { api_v1_netex_imports_path(format: :json) } - let( :entry_group_streams ) do - entry_count.times.map{ |i| double( "entry group stream #{i}" ) } - end - let( :entry_groups ) do - entry_count.times.map do | i | - {"entry_group_name#{i}" => entry_group_streams[i] } + let( :subdirs ) do + entry_count.times.map do |i| + ZipService::Subdir.new( + "subdir #{i}", + double("subdir #{i}", rewind: 0, read: '') + ) end end @@ -38,6 +33,8 @@ RSpec.describe WorkbenchImportWorker, type: [:worker, :request] do let( :post_response_ok ){ double(status: 201, body: "{}") } before do + Timecop.freeze(Time.now) + # Silence Logger allow_any_instance_of(Logger).to receive(:info) allow_any_instance_of(Logger).to receive(:warn) @@ -47,8 +44,15 @@ RSpec.describe WorkbenchImportWorker, type: [:worker, :request] do allow(Api::V1::ApiKey).to receive(:from).and_return(api_key) allow(ZipService).to receive(:new).with(downloaded_zip).and_return zip_service - expect(zip_service).to receive(:entry_group_streams).and_return(entry_groups) - expect( import ).to receive(:update_attributes).with(status: 'running') + expect(zip_service).to receive(:subdirs).and_return(subdirs) + expect( import ).to receive(:update).with( + status: 'running', + started_at: Time.now + ) + end + + after do + Timecop.return end @@ -61,13 +65,14 @@ RSpec.describe WorkbenchImportWorker, type: [:worker, :request] do .with(host: host, path: path, params: {token: download_token}) .and_return( download_zip_response ) - entry_groups.each do | entry_group_name, entry_group_stream | - mock_post entry_group_name, entry_group_stream, post_response_ok + subdirs.each do |subdir| + mock_post subdir, post_response_ok end - expect( import ).to receive(:update_attributes).with(total_steps: 2) - expect( import ).to receive(:update_attributes).with(current_step: 1) - expect( import ).to receive(:update_attributes).with(current_step: 2) + expect( import ).to receive(:update).with(total_steps: 2) + expect( import ).to receive(:update).with(current_step: 1) + expect( import ).to receive(:update).with(current_step: 2) + expect( import ).to receive(:update).with(ended_at: Time.now) worker.perform import.id @@ -83,37 +88,45 @@ RSpec.describe WorkbenchImportWorker, type: [:worker, :request] do .with(host: host, path: path, params: {token: download_token}) .and_return( download_zip_response ) - # First entry_group succeeds - entry_groups[0..0].each do | entry_group_name, entry_group_stream | - mock_post entry_group_name, entry_group_stream, post_response_ok + # First subdir succeeds + subdirs[0..0].each do |subdir| + mock_post subdir, post_response_ok end - # Second entry_group fails (M I S E R A B L Y) - entry_groups[1..1].each do | entry_group_name, entry_group_stream | - mock_post entry_group_name, entry_group_stream, post_response_failure - WorkbenchImportWorker::RETRY_DELAYS.each do | delay | - mock_post entry_group_name, entry_group_stream, post_response_failure - expect_any_instance_of(RetryService).to receive(:sleep).with(delay) - end + # Second subdir fails (M I S E R A B L Y) + subdirs[1..1].each do |subdir| + mock_post subdir, post_response_failure end - expect( import ).to receive(:update_attributes).with(total_steps: 3) - expect( import ).to receive(:update_attributes).with(current_step: 1) - expect( import ).to receive(:update_attributes).with(current_step: 2) - expect( import ).to receive(:update_attributes).with(current_step: 3, status: 'failed') + expect( import ).to receive(:update).with(total_steps: 3) + expect( import ).to receive(:update).with(current_step: 1) + expect( import ).to receive(:update).with(current_step: 2) + expect( import ).to receive(:update).with(current_step: 3, status: 'failed') - worker.perform import.id + expect { worker.perform import.id }.to raise_error(StopIteration) end end - def mock_post entry_group_name, entry_group_stream, response + def mock_post subdir, response + allow(HTTPService).to receive(:upload) expect( HTTPService ).to receive(:post_resource) - .with(host: host, - path: upload_path, - token: api_key.token, - params: params, - upload: {file: [entry_group_stream, 'application/zip', entry_group_name]}) - .and_return(response) + .with( + host: host, + path: upload_path, + params: { + netex_import: { + parent_id: import.id, + parent_type: import.class.name, + workbench_id: workbench.id, + name: subdir.name, + file: HTTPService.upload( + subdir.stream, + 'application/zip', + "#{subdir.name}.zip" + ) + } + } + ).and_return(response) end end |
