Commit 193a85c4a9c052dc3686fa7b77a16db4566d21a0
Committed by
Gabriel Silva
1 parent
e03cd10d
Exists in
remove_secondary_email_from_user
Fixes unit and integration tests
- Removes selenium and cucmber tests (Gov User and Software Communities) - Removes secondary email tests - Fixes institution CNPJ validation Signed-off-by: Luciano Prestes Cavalcanti <lucianopcbr@gmail.com> Signed-off-by: Gustavo Coelho <gust.rod.coelho@gmail.com> Signed-off-by: Gabriel Silva <gabriel93.silva@gmail.com>
Showing
16 changed files
with
65 additions
and
88 deletions
Show diff stats
src/noosfero-spb/gov_user/features/institution_registration.feature
... | ... | @@ -5,9 +5,12 @@ Feature: Institution Field |
5 | 5 | |
6 | 6 | Background: |
7 | 7 | Given "GovUserPlugin" plugin is enabled |
8 | + And "SoftwareCommunitiesPlugin" plugin is enabled | |
8 | 9 | And I am logged in as mpog_admin |
10 | + And I go to /admin/environment_themes/set/noosfero-spb-theme | |
9 | 11 | And I go to /admin/plugins |
10 | 12 | And I check "GovUserPlugin" |
13 | + And I check "SoftwareCommunitiesPlugin" | |
11 | 14 | And I press "Save changes" |
12 | 15 | And Institutions has initial default values on database |
13 | 16 | And I am logged in as mpog_admin |
... | ... | @@ -27,6 +30,6 @@ Feature: Institution Field |
27 | 30 | And I should see "CNPJ" |
28 | 31 | And I should see "Acronym" |
29 | 32 | And I choose "Public Institution" |
30 | - Then I should see "Governmental Sphere:" | |
31 | - And I should see "Governmental Power:" | |
32 | - And I should see "Juridical Nature:" | |
33 | + Then I should see "Governmental Sphere" | |
34 | + And I should see "Governmental Power" | |
35 | + And I should see "Juridical Nature" | ... | ... |
src/noosfero-spb/gov_user/features/rate_community.feature
... | ... | @@ -38,7 +38,7 @@ Feature: rate_community |
38 | 38 | And I go to mycommunity's control panel |
39 | 39 | And I follow "Process requests" within ".pending-tasks" |
40 | 40 | And I choose "Accept" within ".task_decisions" |
41 | - Then I should see "This instiution already has an accepted rating" in the page | |
41 | + Then I should see "This institution already has an accepted rating." in the page | |
42 | 42 | |
43 | 43 | Scenario: do not display message on task when a rating with the same institution does not exist on the same software |
44 | 44 | Given the following organization ratings | ... | ... |
src/noosfero-spb/gov_user/features/rating_institution_registration.feature
... | ... | @@ -8,6 +8,7 @@ Feature: Create institution on user report |
8 | 8 | And "SoftwareCommunitiesPlugin" plugin is enabled |
9 | 9 | And "OrganizationRatings" plugin is enabled |
10 | 10 | And I am logged in as mpog_admin |
11 | + And I go to /admin/environment_themes/set/noosfero-spb-theme | |
11 | 12 | And I go to /admin/plugins |
12 | 13 | And I check "GovUserPlugin" |
13 | 14 | And I check "SoftwareCommunitiesPlugin" |
... | ... | @@ -23,20 +24,20 @@ Feature: Create institution on user report |
23 | 24 | And I should not see "Number of Beneficiaries" |
24 | 25 | And I should not see "Saved resources" |
25 | 26 | And I should not see "Organization name or Enterprise name" |
26 | - When I click on anything with selector "#comments-additional-information" | |
27 | - Then I should see "Number of Beneficiaries" | |
28 | - And I should see "Organization name or Enterprise name" | |
29 | - And I should see "Saved resources" | |
27 | + When I click on anything with selector "comments-additional-information" | |
28 | + Then I should see "Número de beneficiados" | |
29 | + And I should see "Nome do órgão ou empresa" | |
30 | + And I should see "Recursos economizados" | |
30 | 31 | |
31 | 32 | @selenium |
32 | 33 | Scenario: Show new institution fields when clicked in add new institution |
33 | 34 | Given I go to /profile/noosfero/plugin/organization_ratings/new_rating |
34 | - And I click on anything with selector "#comments-additional-information" | |
35 | + And I sleep for 1 seconds | |
36 | + And I click on anything with selector "comments-additional-information" | |
35 | 37 | And I fill in "input_institution" with "None institution" |
36 | 38 | And I sleep for 2 seconds |
37 | 39 | When I follow "Add" |
38 | - Then I should see "New Institution" | |
39 | - And I should see "Public Institution" | |
40 | + Then I should see "Public Institution" | |
40 | 41 | And I should see "Private Institution" |
41 | 42 | And I should see "Corporate Name" |
42 | 43 | And I should see "Name" |
... | ... | @@ -46,33 +47,30 @@ Feature: Create institution on user report |
46 | 47 | And I should see "CNPJ" |
47 | 48 | And I should see "Acronym" |
48 | 49 | And I choose "Public Institution" |
49 | - And I should see "Governmental Sphere:" | |
50 | - And I should see "Governmental Power:" | |
51 | - And I should see "Juridical Nature:" | |
50 | + And I should see "Governmental Sphere" | |
51 | + And I should see "Governmental Power" | |
52 | + And I should see "Juridical Nature" | |
52 | 53 | |
53 | 54 | @selenium |
54 | 55 | Scenario: Create new institution with name changed in the modal |
55 | 56 | Given I go to /profile/noosfero/plugin/organization_ratings/new_rating |
56 | - And I click on anything with selector "#comments-additional-information" | |
57 | + And I sleep for 1 seconds | |
58 | + And I click on anything with selector "comments-additional-information" | |
57 | 59 | And I fill in "input_institution" with "None institution" |
58 | 60 | And I sleep for 2 seconds |
59 | - When I click on anything with selector "#create_institution_link" | |
61 | + When I click on anything with selector "create_institution_link" | |
60 | 62 | And I fill in "community_name" with "Noosfero Institution" |
61 | - And I select "United States" from "#community_country" | |
62 | - And I follow "#save_institution_button" | |
63 | + And I select "United States" from "Country" | |
64 | + And I sleep for 1 seconds | |
65 | + And I follow "Save" | |
63 | 66 | Then I should see "Noosfero Institution" |
64 | 67 | |
65 | 68 | @selenium |
66 | 69 | Scenario: Check new institution name in the modal |
67 | 70 | Given I go to /profile/noosfero/plugin/organization_ratings/new_rating |
68 | - And I click on anything with selector "#comments-additional-information" | |
71 | + And I sleep for 1 seconds | |
72 | + And I click on anything with selector "comments-additional-information" | |
69 | 73 | And I fill in "input_institution" with "None institution" |
70 | 74 | And I sleep for 2 seconds |
71 | - When I click on anything with selector "#create_institution_link" | |
72 | - Then I should see "None Institution" within "community_name" | |
73 | - | |
74 | - | |
75 | - | |
76 | - | |
77 | - | |
78 | - | |
75 | + When I click on anything with selector "create_institution_link" | |
76 | + Then I should see "None institution" in "Corporate Name" field | ... | ... |
src/noosfero-spb/gov_user/features/user_profile_edition.feature
... | ... | @@ -5,12 +5,15 @@ Feature: Institution Field |
5 | 5 | |
6 | 6 | Background: |
7 | 7 | Given "GovUserPlugin" plugin is enabled |
8 | + And "SoftwareCommunitiesPlugin" plugin is enabled | |
8 | 9 | And the following users |
9 | 10 | | login | name | |
10 | 11 | | joao | Joao Silva | |
11 | 12 | And I am logged in as admin |
13 | + And I go to /admin/environment_themes/set/noosfero-spb-theme | |
12 | 14 | And I go to /admin/plugins |
13 | 15 | And I check "GovUserPlugin" |
16 | + And I check "SoftwareCommunitiesPlugin" | |
14 | 17 | And I press "Save changes" |
15 | 18 | And feature "skip_new_user_email_confirmation" is enabled on environment |
16 | 19 | And I go to /admin/features/manage_fields |
... | ... | @@ -44,13 +47,12 @@ Feature: Institution Field |
44 | 47 | Given I am logged in as "joao" |
45 | 48 | And I am on joao's control panel |
46 | 49 | When I follow "Edit Profile" |
47 | - And I follow "Add new institution" | |
48 | 50 | And I type in "Minis" in autocomplete list "#input_institution" and I choose "Ministerio do Planejamento" |
49 | 51 | And I follow "Add new institution" |
50 | 52 | And I type in "Gover" in autocomplete list "#input_institution" and I choose "Governo do DF" |
51 | 53 | And I follow "Add new institution" |
52 | - Then I should see "Ministerio do Planejamento" within ".institutions_added" | |
53 | - And I should see "Governo do DF" within ".institutions_added" | |
54 | + Then I should see "Ministerio do Planejamento" | |
55 | + And I should see "Governo do DF" | |
54 | 56 | |
55 | 57 | @selenium |
56 | 58 | Scenario: Verify if field 'city' is shown when Brazil is selected | ... | ... |
src/noosfero-spb/gov_user/lib/private_institution.rb
1 | 1 | class PrivateInstitution < Institution |
2 | 2 | validates :cnpj, |
3 | - :presence=>true, | |
4 | 3 | :format => {with: CNPJ_FORMAT}, |
5 | 4 | :if => :is_a_brazilian_institution? |
6 | 5 | |
7 | 6 | validates :cnpj, |
8 | - :uniqueness=>true, :unless => 'cnpj.blank?' | |
7 | + :uniqueness => true, :unless => 'cnpj.blank?' | |
9 | 8 | |
10 | 9 | private |
11 | 10 | def is_a_brazilian_institution? | ... | ... |
src/noosfero-spb/gov_user/test/functional/gov_user_plugin_controller_test.rb
... | ... | @@ -105,9 +105,9 @@ class GovUserPluginControllerTest < ActionController::TestCase |
105 | 105 | |
106 | 106 | fields = InstitutionTestHelper.generate_form_fields( |
107 | 107 | "Some Private Institution", |
108 | - "BR", | |
109 | - "DF", | |
110 | - "Brasilia", | |
108 | + "EN", | |
109 | + "NY", | |
110 | + "New York", | |
111 | 111 | "", |
112 | 112 | "PrivateInstitution" |
113 | 113 | ) | ... | ... |
src/noosfero-spb/gov_user/test/unit/institutions_block_test.rb
src/noosfero-spb/gov_user/test/unit/organization_rating_test.rb
... | ... | @@ -16,15 +16,14 @@ class OrganizationRatingTest < ActiveSupport::TestCase |
16 | 16 | private_institution = build_private_institution "huehue", "hue", "11.222.333/4444-55" |
17 | 17 | |
18 | 18 | community_rating = OrganizationRating.new(:person => person, :value => 3, :organization => community, :institution => private_institution) |
19 | - assert_equal false, community_rating.valid? | |
20 | 19 | |
21 | - assert_equal true, community_rating.errors[:institution].include?("not found") | |
20 | + assert_equal false, community_rating.valid? | |
22 | 21 | |
23 | 22 | private_institution.save |
24 | 23 | community_rating.institution = private_institution |
25 | 24 | |
26 | 25 | assert_equal true, community_rating.valid? |
27 | - assert_equal false, community_rating.errors[:institution].include?("not found") | |
26 | + assert_equal false, community_rating.errors[:institution].include?("institution not found") | |
28 | 27 | end |
29 | 28 | |
30 | 29 | private | ... | ... |
src/noosfero-spb/gov_user/test/unit/person_test.rb
... | ... | @@ -12,7 +12,6 @@ class SoftwareCommunitiesPluginPersonTest < ActiveSupport::TestCase |
12 | 12 | "user@email.com", |
13 | 13 | "123456", |
14 | 14 | "123456", |
15 | - "user@secondaryemail.com", | |
16 | 15 | "Any State", |
17 | 16 | "Some City" |
18 | 17 | ) |
... | ... | @@ -22,7 +21,7 @@ class SoftwareCommunitiesPluginPersonTest < ActiveSupport::TestCase |
22 | 21 | @person.cell_phone = "76888919" |
23 | 22 | @person.contact_phone = "987654321" |
24 | 23 | |
25 | - assert_equal(67, @plugin.calc_percentage_registration(@person)) | |
24 | + assert_equal(64, @plugin.calc_percentage_registration(@person)) | |
26 | 25 | |
27 | 26 | @person.comercial_phone = "11223344" |
28 | 27 | @person.country = "I dont know" | ... | ... |
src/noosfero-spb/gov_user/views/person_editor_extras.html.erb
... | ... | @@ -12,6 +12,7 @@ |
12 | 12 | <%= content_tag(:div, _("No institution found"), :id=>"institution_empty_ajax_message", :class=>"errorExplanation hide-field") %> |
13 | 13 | |
14 | 14 | <%= InstitutionModalHelper.modal_button %> |
15 | + <%= link_to(_("Add new institution"), "#", :class=>'button with-text icon-add', :id => 'add_new_institution') %> | |
15 | 16 | |
16 | 17 | <%= hidden_field_tag("user[institution_ids][]", "", :class => 'user_institutions') %> |
17 | 18 | <%= hidden_field_tag("institution_selected", "") %> | ... | ... |
src/noosfero-spb/software_communities/features/public_software_validation.feature
... | ... | @@ -22,13 +22,13 @@ Feature: edit adherent fields |
22 | 22 | Given I am logged in as "joaosilva" |
23 | 23 | And I go to /myprofile/basic-software/plugin/software_communities/edit_software |
24 | 24 | And I follow "Specifications" |
25 | - Then I should see "Public software" within ".public_software_disabled" | |
25 | + Then the "#software_public_software" button should be disabled | |
26 | 26 | |
27 | 27 | Scenario: Enable public software checkbox to admin users |
28 | 28 | Given I am logged in as mpog_admin |
29 | 29 | And I go to /myprofile/basic-software/plugin/software_communities/edit_software |
30 | 30 | And I follow "Specifications" |
31 | - Then I should see "Public software" within ".public_software_enabled" | |
31 | + Then the "#software_public_software" button should be enabled | |
32 | 32 | |
33 | 33 | @selenium |
34 | 34 | Scenario: Show adherent fields when checkbox are checked | ... | ... |
src/noosfero-spb/software_communities/features/software_block.feature
... | ... | @@ -15,8 +15,7 @@ Feature: edit adherent fields |
15 | 15 | | Generic Software | false | some finality | |
16 | 16 | |
17 | 17 | Scenario: Add software block |
18 | - Given I am logged in as mpog_admin | |
19 | - And I follow "Control panel" | |
18 | + Given I follow "Control panel" | |
20 | 19 | And I follow "Edit sideboxes" |
21 | 20 | When I follow "Add a block" |
22 | 21 | And I choose "Softwares" |
... | ... | @@ -24,9 +23,7 @@ Feature: edit adherent fields |
24 | 23 | Then I should see "softwares" |
25 | 24 | |
26 | 25 | Scenario: Change software block to generic software block |
27 | - Given I am logged in as mpog_admin | |
28 | - And I go to /myprofile/mpog_admin | |
29 | - And I follow "Control panel" | |
26 | + Given I follow "Control panel" | |
30 | 27 | And I follow "Edit sideboxes" |
31 | 28 | When I follow "Add a block" |
32 | 29 | And I choose "Softwares" |
... | ... | @@ -37,8 +34,7 @@ Feature: edit adherent fields |
37 | 34 | Then I should see "generic software" |
38 | 35 | |
39 | 36 | Scenario: Change software block to generic software block |
40 | - Given I am logged in as mpog_admin | |
41 | - And I follow "Control panel" | |
37 | + Given I follow "Control panel" | |
42 | 38 | And I follow "Edit sideboxes" |
43 | 39 | When I follow "Add a block" |
44 | 40 | And I choose "Softwares" | ... | ... |
src/noosfero-spb/software_communities/features/software_catalog.feature
... | ... | @@ -59,7 +59,7 @@ Feature: Search software |
59 | 59 | @selenium |
60 | 60 | Scenario: Show only "Software Two" when searching for "Education" category |
61 | 61 | Given I go to /search/software_infos |
62 | - And I click on anything with selector "#filter-option-catalog-software" | |
62 | + And I click on anything with selector "filter-option-catalog-software" | |
63 | 63 | And I check "Education" |
64 | 64 | Then I should see "Software Two" |
65 | 65 | And I should not see "Software One" |
... | ... | @@ -67,7 +67,7 @@ Feature: Search software |
67 | 67 | @selenium |
68 | 68 | Scenario: Show both Software "One" and "Two" when searching for "Health" category |
69 | 69 | Given I go to /search/software_infos |
70 | - And I click on anything with selector "#filter-option-catalog-software" | |
70 | + And I click on anything with selector "filter-option-catalog-software" | |
71 | 71 | And I check "Health" |
72 | 72 | Then I should see "Software One" |
73 | 73 | And I should see "Software Two" |
... | ... | @@ -75,8 +75,7 @@ Feature: Search software |
75 | 75 | @selenium |
76 | 76 | Scenario: Show not "public_software" when "Include in results" is checked |
77 | 77 | Given I go to /search/software_infos |
78 | - And I click on anything with selector "#filter-option-catalog-software" | |
79 | - And I check "include_non_public" | |
78 | + And I choose "all_radio_button" | |
80 | 79 | Then I should see "Software One" |
81 | 80 | And I should see "Software Two" |
82 | 81 | And I should see "Software Three" |
... | ... | @@ -107,6 +106,5 @@ Feature: Search software |
107 | 106 | When I select "Favorites" from "sort" |
108 | 107 | And I sleep for 3 seconds |
109 | 108 | Then I should see "Software Two" before "Software One" |
110 | - And there should be 1 div with class "small-star-positive" | |
111 | - And there should be 4 divs with class "small-star-negative" | |
112 | - | |
109 | + And I should see "1" of this selector "div.medium-star-positive" | |
110 | + And I should see "4" of this selector "div.medium-star-negative" | ... | ... |
src/noosfero-spb/software_communities/features/step_definitions/software_communities_steps.rb
... | ... | @@ -18,29 +18,6 @@ Given /^SoftwareInfo has initial default values on database$/ do |
18 | 18 | OperatingSystemName.create(:name=>"CentOS") |
19 | 19 | end |
20 | 20 | |
21 | -Given /^Institutions has initial default values on database$/ do | |
22 | - GovernmentalPower.create(:name => "Executivo") | |
23 | - GovernmentalPower.create(:name => "Legislativo") | |
24 | - GovernmentalPower.create(:name => "Judiciario") | |
25 | - | |
26 | - GovernmentalSphere.create(:name => "Federal") | |
27 | - | |
28 | - JuridicalNature.create(:name => "Autarquia") | |
29 | - JuridicalNature.create(:name => "Administracao Direta") | |
30 | - JuridicalNature.create(:name => "Empresa Publica") | |
31 | - JuridicalNature.create(:name => "Fundacao") | |
32 | - JuridicalNature.create(:name => "Orgao Autonomo") | |
33 | - JuridicalNature.create(:name => "Sociedade") | |
34 | - JuridicalNature.create(:name => "Sociedade Civil") | |
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 | |
42 | -end | |
43 | - | |
44 | 21 | Given /^I type in "([^"]*)" in autocomplete list "([^"]*)" and I choose "([^"]*)"$/ do |typed, input_field_selector, should_select| |
45 | 22 | # Wait the page javascript load |
46 | 23 | sleep 1 |
... | ... | @@ -291,6 +268,10 @@ Then /^there should be (\d+) divs? with class "([^"]*)"$/ do |count, klass| |
291 | 268 | should have_selector("div.#{klass}", :count => count) |
292 | 269 | end |
293 | 270 | |
271 | +Then /^I should see "([^"]*)" in "([^"]*)" field$/ do |content, field| | |
272 | + should have_field(field, :with => content) | |
273 | +end | |
274 | + | |
294 | 275 | Given /^I should see "([^"]*)" in the page/ do |message| |
295 | 276 | assert_match message, page.body |
296 | 277 | end | ... | ... |
src/noosfero-spb/software_communities/features/use_report.feature
... | ... | @@ -34,10 +34,10 @@ Feature: Use report |
34 | 34 | Scenario: Test Additional Fields JavaScript |
35 | 35 | Given I go to /profile/noosfero/plugin/organization_ratings/new_rating |
36 | 36 | Then I should not see "Number of Beneficiaries" |
37 | - And I should not see "Saved Resources" | |
37 | + And I should not see "Saved resources" | |
38 | 38 | When I click on anything with selector "comments-additional-information" |
39 | 39 | Then I should see "Number of Beneficiaries" |
40 | - And I should see "Saved Resources" | |
40 | + And I should see "Saved resources" | |
41 | 41 | |
42 | 42 | @selenium |
43 | 43 | Scenario: Validate Use Report fields format |
... | ... | @@ -49,8 +49,8 @@ Feature: Use report |
49 | 49 | And I am on Noosfero's homepage |
50 | 50 | And I follow "Rate Community" |
51 | 51 | When I click on anything with selector "comments-additional-information" |
52 | - And I fill in "organization_rating_people_benefited" with "123123" | |
53 | - And I fill in "organization_rating_saved_value" with "7654321" | |
52 | + And I fill in "people_benefited_tmp" with "123123" | |
53 | + And I fill in "saved_value_tmp" with "7654321" | |
54 | 54 | And I press "Save" |
55 | - Then I should see "Benefited People: 123.123" | |
56 | - And I should see "Saved Resources: $ 76,543.21" | |
55 | + Then I should see "Benefited People: 123,123" | |
56 | + And I should see "Saved Resources: $76,543.21" | ... | ... |
src/noosfero-spb/software_communities/views/search/_catalog_filter.html.erb
... | ... | @@ -6,8 +6,10 @@ |
6 | 6 | <ul> |
7 | 7 | <% @categories.each do |category| %> |
8 | 8 | <li> |
9 | - <%= check_box_tag("selected_categories_id[]", category.id, @selected_categories_id.include?(category.id), :class => "categories-catalog", @enabled_check_box[category] => "true") %> | |
10 | - <span><%= _("#{category.name}") %></span> | |
9 | + <label> | |
10 | + <%= check_box_tag("selected_categories_id[]", category.id, @selected_categories_id.include?(category.id), :class => "categories-catalog", @enabled_check_box[category] => "true") %> | |
11 | + <span><%= _("#{category.name}") %></span> | |
12 | + </label> | |
11 | 13 | </li> |
12 | 14 | <% end %> |
13 | 15 | </ul> | ... | ... |