Commit feedfd2f56f98ff8465c9480553ec9fcb7680a9f
1 parent
dd9c7042
Exists in
master
and in
5 other branches
Update functional tests of user registration with institutions in account_controller_test.rb
(institution_fields) Signed-off-by: Luciano Prestes Cavalcanti <lucianopcbr@gmail.com>
Showing
1 changed file
with
16 additions
and
8 deletions
Show diff stats
test/functional/account_controller_test.rb
... | ... | @@ -12,14 +12,15 @@ class AccountControllerTest < ActionController::TestCase |
12 | 12 | |
13 | 13 | @govPower = GovernmentalPower.create(:name=>"Some Gov Power") |
14 | 14 | @govSphere = GovernmentalSphere.create(:name=>"Some Gov Sphere") |
15 | + @juridical_nature = JuridicalNature.create(:name => "Autarquia") | |
15 | 16 | |
16 | 17 | @controller = AccountController.new |
17 | 18 | @request = ActionController::TestRequest.new |
18 | 19 | @response = ActionController::TestResponse.new |
19 | 20 | |
20 | 21 | @institution_list = [] |
21 | - @institution_list << create_institution("Ministerio Publico da Uniao", "MPU") | |
22 | - @institution_list << create_institution("Tribunal Regional da Uniao", "TRU") | |
22 | + @institution_list << create_public_institution("Ministerio Publico da Uniao", "MPU", "BR", "DF", "Gama", @juridical_nature, @govPower, @govSphere) | |
23 | + @institution_list << create_public_institution("Tribunal Regional da Uniao", "TRU", "BR", "DF", "Brasilia", @juridical_nature, @govPower, @govSphere) | |
23 | 24 | |
24 | 25 | @user_info = { |
25 | 26 | :login=>"novo_usuario", |
... | ... | @@ -91,15 +92,22 @@ class AccountControllerTest < ActionController::TestCase |
91 | 92 | |
92 | 93 | private |
93 | 94 | |
94 | - def create_institution name, acronym | |
95 | - institution_community = Community::create :name=>name | |
95 | + def create_public_institution name, acronym, country, state, city, juridical_nature, gov_p, gov_s | |
96 | + institution_community = fast_create(Community) | |
97 | + institution_community.name = name | |
98 | + institution_community.country = country | |
99 | + institution_community.state = state | |
100 | + institution_community.city = city | |
101 | + institution_community.save! | |
102 | + | |
96 | 103 | institution = PublicInstitution.new |
97 | 104 | institution.community = institution_community |
98 | 105 | institution.name = name |
99 | - institution.acronym = acronym | |
100 | - institution.governmental_power = @govPower | |
101 | - institution.governmental_sphere = @govSphere | |
102 | - institution.save | |
106 | + institution.juridical_nature = juridical_nature | |
107 | + institution.acronym = acronym | |
108 | + institution.governmental_power = gov_p | |
109 | + institution.governmental_sphere = gov_s | |
110 | + institution.save! | |
103 | 111 | institution |
104 | 112 | end |
105 | 113 | ... | ... |