From 677c647df194a5f5f27ee21243982340157d2ca5 Mon Sep 17 00:00:00 2001 From: MoisesMachado Date: Mon, 21 Jul 2008 21:10:37 +0000 Subject: [PATCH] ActionItem558: upgraded the test data --- script/anhetegua | 60 +++++++++++++++++++++++++++++++++--------------------------- 1 file changed, 33 insertions(+), 27 deletions(-) diff --git a/script/anhetegua b/script/anhetegua index 8da2367..089d332 100755 --- a/script/anhetegua +++ b/script/anhetegua @@ -24,6 +24,10 @@ def new_region(parent, name, color = nil) region end +def new_state(parent, name) + State.create!(:name => name, :parent => parent, :environment => Environment.default) +end + def new_validator(region, name, identifier, klass = Organization) org = klass.new(:name => name, :identifier => identifier) org.validation_info = ValidationInfo.new(:validation_methodology => 'some methodology we don\'t care about') @@ -84,37 +88,37 @@ territorios = new_region(nil, 'Territórios', 2) nacional = new_region(territorios, 'Nacional') internacional = new_region(territorios, 'Internacional') centro_oeste = new_region(nacional, 'Região Centro-Oeste') -mt = new_region(centro_oeste, 'Mato Grosso') -ms = new_region(centro_oeste, 'Mato Grosso do Sul') -go = new_region(centro_oeste, 'Goiás') -df = new_region(centro_oeste, 'Distrito Federal') +mt = new_state(centro_oeste, 'Mato Grosso') +ms = new_state(centro_oeste, 'Mato Grosso do Sul') +go = new_state(centro_oeste, 'Goiás') +df = new_state(centro_oeste, 'Distrito Federal') nordeste = new_region(nacional, 'Região Nordeste') -al = new_region(nordeste, 'Alagoas') -ba = new_region(nordeste, 'Bahia') -ce = new_region(nordeste, 'Ceará') -ma = new_region(nordeste, 'Maranhão') -pb = new_region(nordeste, 'Paraíba') -pe = new_region(nordeste, 'Pernambuco') -pi = new_region(nordeste, 'Piauí') -rn = new_region(nordeste, 'Rio Grande do Norte') -se = new_region(nordeste, 'Sergipe') +al = new_state(nordeste, 'Alagoas') +ba = new_state(nordeste, 'Bahia') +ce = new_state(nordeste, 'Ceará') +ma = new_state(nordeste, 'Maranhão') +pb = new_state(nordeste, 'Paraíba') +pe = new_state(nordeste, 'Pernambuco') +pi = new_state(nordeste, 'Piauí') +rn = new_state(nordeste, 'Rio Grande do Norte') +se = new_state(nordeste, 'Sergipe') norte = new_region(nacional, 'Região Norte') -ac = new_region(norte, 'Acre') -ap = new_region(norte, 'Amapá') -am = new_region(norte, 'Amazonas') -pa = new_region(norte, 'Pará') -ro = new_region(norte, 'Rondônia') -rr = new_region(norte, 'Roraima') -to = new_region(norte, 'Tocantins') +ac = new_state(norte, 'Acre') +ap = new_state(norte, 'Amapá') +am = new_state(norte, 'Amazonas') +pa = new_state(norte, 'Pará') +ro = new_state(norte, 'Rondônia') +rr = new_state(norte, 'Roraima') +to = new_state(norte, 'Tocantins') sudeste = new_region(nacional, 'Região Sudeste') -mg = new_region(sudeste, 'Minas Gerais') -sp = new_region(sudeste, 'São Paulo') -rj = new_region(sudeste, 'Rio de Janeiro') -es = new_region(sudeste, 'Espírito Santo') +mg = new_state(sudeste, 'Minas Gerais') +sp = new_state(sudeste, 'São Paulo') +rj = new_state(sudeste, 'Rio de Janeiro') +es = new_state(sudeste, 'Espírito Santo') sul = new_region(nacional, 'Região Sul') -pr = new_region(sul, 'Paraná') -rs = new_region(sul, 'Rio Grande do Sul') -sc = new_region(sul, 'Santa Catarina') +pr = new_state(sul, 'Paraná') +rs = new_state(sul, 'Rio Grande do Sul') +sc = new_state(sul, 'Santa Catarina') cadeias = new_category(nil, 'Redes/Cadeias', 3) new_category(cadeias, 'Agropecuária, extrativismo e pesca') @@ -150,6 +154,8 @@ owner_role = Profile::Roles.admin # Sample user and sample enterprise owned by him ze = User.create!(:login => 'ze', :email => 'ze@localhost.localdomain', :password => 'test', :password_confirmation => 'test').person + +Environment.default.affiliate(ze, Environment::Roles.admin) empa = Enterprise.create!(:name => 'Cooperativa A', :identifier => 'coop_a') empa.affiliate(ze, owner_role) -- libgit2 0.21.2