Commit dd6a2ef10a25aa53f0c58c14a31c2b66f403e00a

Authored by Parley
1 parent fdd8cbe6

Fix cucumber tests of institution

Signed-off-by: Parley Martins <parley@outlook.com>
Signed-off-by: Fabio Teixeira <fabio1079@gmail.com>
Signed-off-by: Luciano Prestes Cavalcanti <lucianopcbr@gmail.com>
features/institution_registration.feature
... ... @@ -17,89 +17,16 @@ Feature: Institution Field
17 17 Given I follow "Edit Profile"
18 18 When I follow "Create new institution"
19 19 And I should see "New Institution"
20   - And I should see "Name"
21   - And I should see "State"
22   - And I should see "City"
23   - And I should see "Country"
24   - And I should see "CNPJ"
25 20 And I should see "Public Institution"
26   - And I choose "Public Institution"
27   - And I should see "Acronym"
28   - And I should see "Governmental Power:"
29   - Then I should see "Governmental Sphere:"
30   -
31   - @selenium
32   - Scenario: Show new institution fields when private institution is selected
33   - Given I follow "Edit Profile"
34   - When I follow "Create new institution"
35   - And I should see "New Institution"
  21 + And I should see "Private Institution"
  22 + And I should see "Corporate Name"
36 23 And I should see "Name"
37 24 And I should see "State"
38 25 And I should see "City"
39 26 And I should see "Country"
40 27 And I should see "CNPJ"
41   - And I should see "Private Institution"
42   - And I choose "Private Institution"
43   - Then I should see "Fantasy name"
44   -
45   - @selenium
46   - Scenario: Create new public institution when all required fields are filled.
47   - Given I follow "Edit Profile"
48   - When I follow "Create new institution"
49   - And I fill in "community_name" with "Institution Name"
50   - And I fill in "institutions_cnpj" with "00.000.000/0001-00"
51   - And I select "Brazil" from "community_country"
52   - And I fill in "community_state" with "DF"
53   - And I fill in "community_city" with "Brasilia"
54   - And I choose "Public Institution"
55   - And I select "Executivo" from "institutions_governmental_power"
56   - And I select "Federal" from "institutions_governmental_sphere"
57   - And I select "Autarquia" from "institutions_juridical_nature"
58   - And I follow "Save"
59   - Then I should see "Institution Name"
60   -
61   - @selenium
62   - Scenario: Create new private institution when all required fields are filled
63   - Given I follow "Edit Profile"
64   - When I follow "Create new institution"
65   - And I fill in "community_name" with "Institution Name"
66   - And I fill in "institutions_cnpj" with "00.000.000/0001-00"
67   - And I select "Brazil" from "community_country"
68   - And I fill in "community_state" with "DF"
69   - And I fill in "community_city" with "Brasilia"
70   - And I choose "Private Institution"
71   - And I follow "Save"
72   - Then I should see "Institution Name"
73   -
74   - @selenium
75   - Scenario: Don't create an institution when name and cpnj are not filled
76   - Given I follow "Edit Profile"
77   - When I follow "Create new institution"
78   - And I choose "Private Institution"
79   - And I fill in "institutions_acronym" with "Teste"
80   - And I select "Brazil" from "community_country"
81   - And I fill in "community_state" with "DF"
82   - And I fill in "community_city" with "Brasilia"
83   - And I follow "Save"
84   - Then I should see "Institution could not be created!"
85   -
86   - @selenium
87   - Scenario: Don't Create new institution when a governamental field is not filled
88   - Given I follow "Edit Profile"
89   - When I follow "Create new institution"
90   - And I fill in "community_name" with "Institution Name"
91   - And I fill in "institutions_cnpj" with "00.000.000/0001-00"
92   - And I select "Brazil" from "community_country"
93   - And I fill in "community_state" with "DF"
94   - And I fill in "community_city" with "Brasilia"
95   - And I choose "Public Institution"
96   - And I follow "Save"
97   - Then I should see "Institution could not be created!"
98   -
99   - @selenium
100   - Scenario: Don't Create new institution when no field is filled
101   - Given I follow "Edit Profile"
102   - When I follow "Create new institution"
  28 + And I should see "Acronym"
103 29 And I choose "Public Institution"
104   - And I follow "Save"
105   - Then I should see "Institution could not be created!"
  30 + Then I should see "Governmental Sphere:"
  31 + And I should see "Governmental Power:"
  32 + And I should see "Juridical Nature:"
106 33 \ No newline at end of file
... ...
features/step_definitions/mpog_steps.rb
... ... @@ -33,6 +33,12 @@ Given /^Institutions has initial default values on database$/ do
33 33 JuridicalNature.create(:name => "Sociedade")
34 34 JuridicalNature.create(:name => "Sociedade Civil")
35 35 JuridicalNature.create(:name => "Sociedade de Economia Mista")
  36 +
  37 + national_region = NationalRegion.new
  38 + national_region.name = "Distrito Federal"
  39 + national_region.national_region_code = '35'
  40 + national_region.national_region_type_id = NationalRegionType::STATE
  41 + national_region.save
36 42 end
37 43  
38 44 Given /^I type in "([^"]*)" into autocomplete list "([^"]*)" and I choose "([^"]*)"$/ do |typed, input_institution, should_select|
... ... @@ -60,6 +66,7 @@ Given /^the following public institutions?$/ do |table|
60 66  
61 67 institution = PublicInstitution.new(:name => item[:name], :type => "PublicInstitution", :acronym => item[:acronym], :cnpj => item[:cnpj], :juridical_nature => juridical_nature, :governmental_power => governmental_power, :governmental_sphere => governmental_sphere)
62 68 institution.community = community
  69 + institution.corporate_name = item[:corporate_name]
63 70 institution.save!
64 71 end
65 72 end
... ...
features/user_profile_edition.feature
... ... @@ -17,10 +17,10 @@ Feature: Institution Field
17 17 And I press "Save changes"
18 18 And Institutions has initial default values on database
19 19 And the following public institutions
20   - | name | acronym | country | state | city | cnpj | juridical_nature | governmental_power | governmental_sphere |
21   - | Ministerio das Cidades | MC | BR | DF | Gama | 58.745.189/0001-21 | Autarquia | Executivo | Federal |
22   - | Governo do DF | GDF | BR | DF | Taguatinga | 12.645.166/0001-44 | Autarquia | Legislativo | Federal |
23   - | Ministerio do Planejamento | MP | BR | DF | Brasilia | 41.769.591/0001-43 | Autarquia | Judiciario | Federal |
  20 + | name | acronym | country | state | city | cnpj | juridical_nature | governmental_power | governmental_sphere | corporate_name |
  21 + | Ministerio das Cidades | MC | BR | DF | Gama | 58.745.189/0001-21 | Autarquia | Executivo | Federal | Ministerio das Cidades |
  22 + | Governo do DF | GDF | BR | DF | Taguatinga | 12.645.166/0001-44 | Autarquia | Legislativo | Federal | Governo do DF |
  23 + | Ministerio do Planejamento | MP | BR | DF | Brasilia | 41.769.591/0001-43 | Autarquia | Judiciario | Federal | Ministerio do Planejamento |
24 24 And I am logged in as mpog_admin
25 25  
26 26 @selenium
... ...
lib/mpog_software_plugin.rb
... ... @@ -241,7 +241,8 @@ class MpogSoftwarePlugin &lt; Noosfero::Plugin
241 241 def self.extra_blocks
242 242 {
243 243 SoftwaresBlock => {:type => [Environment, Person] },
244   - SoftwareInformationBlock => {:type => [Community] }
  244 + SoftwareInformationBlock => {:type => [Community] },
  245 + InstitutionsBlock => {:type => [Environment, Person]}
245 246 }
246 247 end
247 248  
... ... @@ -474,12 +475,6 @@ class MpogSoftwarePlugin &lt; Noosfero::Plugin
474 475 end
475 476 end
476 477  
477   - def self.extra_blocks
478   - {
479   - InstitutionsBlock => {:type => [Environment, Person]}
480   - }
481   - end
482   -
483 478 private
484 479  
485 480 # Add and remove the user from it's institutions communities
... ...