add namespace for populate_zones task

This commit is contained in:
Christophe Robillard 2021-12-16 09:49:49 +01:00
parent 882f92268c
commit 822c754581
3 changed files with 11 additions and 9 deletions

View file

@ -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

View file

@ -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

View file

@ -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