add namespace for populate_zones task
This commit is contained in:
parent
882f92268c
commit
822c754581
3 changed files with 11 additions and 9 deletions
|
@ -1,10 +1,12 @@
|
||||||
task populate_zones: :environment do
|
namespace :zones do
|
||||||
puts "Running deploy task 'populate_zones'"
|
task populate_zones: :environment do
|
||||||
|
puts "Running deploy task 'populate_zones'"
|
||||||
|
|
||||||
Zone.create!(acronym: 'COLLECTIVITE', label: 'Collectivité territoriale')
|
Zone.create!(acronym: 'COLLECTIVITE', label: 'Collectivité territoriale')
|
||||||
config = Psych.safe_load(File.read(Rails.root.join("config", "zones.yml")))
|
config = Psych.safe_load(File.read(Rails.root.join("config", "zones.yml")))
|
||||||
config["ministeres"].each do |ministere|
|
config["ministeres"].each do |ministere|
|
||||||
acronym = ministere.keys.first
|
acronym = ministere.keys.first
|
||||||
Zone.create!(acronym: acronym, label: ministere["label"])
|
Zone.create!(acronym: acronym, label: ministere["label"])
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
describe 'populate_zones' do
|
describe 'populate_zones' do
|
||||||
let(:rake_task) { Rake::Task['populate_zones'] }
|
let(:rake_task) { Rake::Task['zones:populate_zones'] }
|
||||||
subject(:run_task) do
|
subject(:run_task) do
|
||||||
rake_task.invoke
|
rake_task.invoke
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
describe UpdateZoneToProceduresService do
|
describe UpdateZoneToProceduresService do
|
||||||
before(:all) do
|
before(:all) do
|
||||||
Rake::Task['populate_zones'].invoke
|
Rake::Task['zones:populate_zones'].invoke
|
||||||
end
|
end
|
||||||
|
|
||||||
after(:all) do
|
after(:all) do
|
||||||
|
|
Loading…
Reference in a new issue