From 3b3d3252aa514fbd5b2c12a6cc0a2825d9d8b12e Mon Sep 17 00:00:00 2001 From: cedricnjanga Date: Fri, 10 Nov 2017 17:23:45 +0100 Subject: Add validation and specs to models on objectid_format presence --- spec/factories/line_referentials.rb | 1 + spec/factories/referentials.rb | 1 + spec/factories/stop_area_referentials.rb | 1 + spec/factories/workbenches.rb | 1 + 4 files changed, 4 insertions(+) (limited to 'spec/factories') diff --git a/spec/factories/line_referentials.rb b/spec/factories/line_referentials.rb index cfce1399f..6db4aab18 100644 --- a/spec/factories/line_referentials.rb +++ b/spec/factories/line_referentials.rb @@ -1,5 +1,6 @@ FactoryGirl.define do factory :line_referential do sequence(:name) { |n| "Line Referential #{n}" } + objectid_format 'netex' end end diff --git a/spec/factories/referentials.rb b/spec/factories/referentials.rb index a4155d181..ece48a54e 100644 --- a/spec/factories/referentials.rb +++ b/spec/factories/referentials.rb @@ -8,6 +8,7 @@ FactoryGirl.define do association :organisation time_zone "Europe/Paris" ready { true } + objectid_format "netex" factory :workbench_referential do association :workbench diff --git a/spec/factories/stop_area_referentials.rb b/spec/factories/stop_area_referentials.rb index c88819010..253ef9715 100644 --- a/spec/factories/stop_area_referentials.rb +++ b/spec/factories/stop_area_referentials.rb @@ -1,5 +1,6 @@ FactoryGirl.define do factory :stop_area_referential, :class => StopAreaReferential do sequence(:name) { |n| "StopArea Referential #{n}" } + objectid_format 'netex' end end diff --git a/spec/factories/workbenches.rb b/spec/factories/workbenches.rb index 57bef2203..f231fcdeb 100644 --- a/spec/factories/workbenches.rb +++ b/spec/factories/workbenches.rb @@ -1,6 +1,7 @@ FactoryGirl.define do factory :workbench do name "Gestion de l'offre" + objectid_format 'netex' association :organisation association :line_referential -- cgit v1.2.3 From 3f39b62beb9ff7af741696a6c3c7e87737c3a257 Mon Sep 17 00:00:00 2001 From: cedricnjanga Date: Thu, 16 Nov 2017 16:44:37 +0100 Subject: Add Cédric new objectid concerns objectid_support handles reading and writing object_ids objectid_formater_support gets the right formater class include these concerns in chouette models Remove StifNetexAttributSupport modules because these are handled by the new objectid concerns Add a objectid and formater classes for each format type Add objectid formats to the factories Modify somes specs for object_ids but there are still a number of failling tests --- spec/factories/chouette_lines.rb | 5 +---- spec/factories/line_referentials.rb | 2 +- spec/factories/referentials.rb | 2 +- spec/factories/stop_area_referentials.rb | 2 +- spec/factories/workbenches.rb | 2 +- 5 files changed, 5 insertions(+), 8 deletions(-) (limited to 'spec/factories') diff --git a/spec/factories/chouette_lines.rb b/spec/factories/chouette_lines.rb index 423ab99f2..fb15e12de 100644 --- a/spec/factories/chouette_lines.rb +++ b/spec/factories/chouette_lines.rb @@ -8,10 +8,7 @@ FactoryGirl.define do association :network, :factory => :network association :company, :factory => :company - - before(:create) do |line| - line.line_referential ||= LineReferential.find_by! name: "first" - end + association :line_referential, :factory => :line_referential sequence(:registration_number) { |n| "test-#{n}" } diff --git a/spec/factories/line_referentials.rb b/spec/factories/line_referentials.rb index 6db4aab18..e9e6dce5a 100644 --- a/spec/factories/line_referentials.rb +++ b/spec/factories/line_referentials.rb @@ -1,6 +1,6 @@ FactoryGirl.define do factory :line_referential do sequence(:name) { |n| "Line Referential #{n}" } - objectid_format 'netex' + objectid_format 'stif_codifligne' end end diff --git a/spec/factories/referentials.rb b/spec/factories/referentials.rb index ece48a54e..0276a47be 100644 --- a/spec/factories/referentials.rb +++ b/spec/factories/referentials.rb @@ -8,7 +8,7 @@ FactoryGirl.define do association :organisation time_zone "Europe/Paris" ready { true } - objectid_format "netex" + objectid_format "stif_netex" factory :workbench_referential do association :workbench diff --git a/spec/factories/stop_area_referentials.rb b/spec/factories/stop_area_referentials.rb index 253ef9715..fcba996e4 100644 --- a/spec/factories/stop_area_referentials.rb +++ b/spec/factories/stop_area_referentials.rb @@ -1,6 +1,6 @@ FactoryGirl.define do factory :stop_area_referential, :class => StopAreaReferential do sequence(:name) { |n| "StopArea Referential #{n}" } - objectid_format 'netex' + objectid_format 'stif_reflex' end end diff --git a/spec/factories/workbenches.rb b/spec/factories/workbenches.rb index f231fcdeb..0f26559d8 100644 --- a/spec/factories/workbenches.rb +++ b/spec/factories/workbenches.rb @@ -1,7 +1,7 @@ FactoryGirl.define do factory :workbench do name "Gestion de l'offre" - objectid_format 'netex' + objectid_format 'stif_netex' association :organisation association :line_referential -- cgit v1.2.3 From 80bfa87237b78e426e4362a503fe4d72e130beb5 Mon Sep 17 00:00:00 2001 From: cedricnjanga Date: Mon, 20 Nov 2017 18:20:24 +0100 Subject: Rearrange policies and decorators folders to include them after renaming class names on several models --- spec/factories/chouette_lines.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'spec/factories') diff --git a/spec/factories/chouette_lines.rb b/spec/factories/chouette_lines.rb index fb15e12de..f6542bf82 100644 --- a/spec/factories/chouette_lines.rb +++ b/spec/factories/chouette_lines.rb @@ -8,7 +8,10 @@ FactoryGirl.define do association :network, :factory => :network association :company, :factory => :company - association :line_referential, :factory => :line_referential + + before(:create) do |line| + line.line_referential ||= LineReferential.find_by! name: "first" + end sequence(:registration_number) { |n| "test-#{n}" } -- cgit v1.2.3 From 0a9b5cd19dc52e00c9516e2a4cf204580d889862 Mon Sep 17 00:00:00 2001 From: cedricnjanga Date: Thu, 23 Nov 2017 17:14:05 +0100 Subject: Add spec for stif_netex objectid_format --- spec/factories/chouette_lines.rb | 5 +++++ spec/factories/chouette_routes.rb | 7 +++++++ 2 files changed, 12 insertions(+) (limited to 'spec/factories') diff --git a/spec/factories/chouette_lines.rb b/spec/factories/chouette_lines.rb index f6542bf82..95f760174 100644 --- a/spec/factories/chouette_lines.rb +++ b/spec/factories/chouette_lines.rb @@ -44,6 +44,11 @@ FactoryGirl.define do end + factory :line_with_after_commit do |line| + line.run_callbacks(:commit) + + end + end end diff --git a/spec/factories/chouette_routes.rb b/spec/factories/chouette_routes.rb index 4986ab70e..4e20059fe 100644 --- a/spec/factories/chouette_routes.rb +++ b/spec/factories/chouette_routes.rb @@ -33,6 +33,13 @@ FactoryGirl.define do end end + factory :route_with_after_commit do + sequence(:objectid) {nil} + after(:create) do |route| + route.run_callbacks(:commit) + end + end + end end -- cgit v1.2.3