diff --git a/lib/tasks/populate_zones.rake b/lib/tasks/populate_zones.rake index d6f660884..b7fce39f8 100644 --- a/lib/tasks/populate_zones.rake +++ b/lib/tasks/populate_zones.rake @@ -1,10 +1,12 @@ -task populate_zones: :environment do - puts "Running deploy task 'populate_zones'" +namespace :zones do + task populate_zones: :environment do + puts "Running deploy task 'populate_zones'" - Zone.create!(acronym: 'COLLECTIVITE', label: 'Collectivité territoriale') - config = Psych.safe_load(File.read(Rails.root.join("config", "zones.yml"))) - config["ministeres"].each do |ministere| - acronym = ministere.keys.first - Zone.create!(acronym: acronym, label: ministere["label"]) + Zone.create!(acronym: 'COLLECTIVITE', label: 'Collectivité territoriale') + config = Psych.safe_load(File.read(Rails.root.join("config", "zones.yml"))) + config["ministeres"].each do |ministere| + acronym = ministere.keys.first + Zone.create!(acronym: acronym, label: ministere["label"]) + end end end diff --git a/spec/lib/tasks/populate_zones_spec.rb b/spec/lib/tasks/populate_zones_spec.rb index e3cbd0ab1..2140c83c1 100644 --- a/spec/lib/tasks/populate_zones_spec.rb +++ b/spec/lib/tasks/populate_zones_spec.rb @@ -1,5 +1,5 @@ describe 'populate_zones' do - let(:rake_task) { Rake::Task['populate_zones'] } + let(:rake_task) { Rake::Task['zones:populate_zones'] } subject(:run_task) do rake_task.invoke end diff --git a/spec/services/update_zone_to_procedures_service_spec.rb b/spec/services/update_zone_to_procedures_service_spec.rb index 468ff1212..a0e34fffe 100644 --- a/spec/services/update_zone_to_procedures_service_spec.rb +++ b/spec/services/update_zone_to_procedures_service_spec.rb @@ -1,6 +1,6 @@ describe UpdateZoneToProceduresService do before(:all) do - Rake::Task['populate_zones'].invoke + Rake::Task['zones:populate_zones'].invoke end after(:all) do