Commit 76e5cf98ca302ed6d1aab487c4597d444c64490c
1 parent
c550c104
Exists in
master
and in
17 other branches
Fixes unit and integration tests
- Fix validations 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> Signed-off-by: Omar Junior <omarroinuj@gmail.com> Signed-off-by: Pedro de Lyra <pedrodelyra@gmail.com> Signed-off-by: Tallys Martins <tallysmartins@yahoo.com.br> Signed-off-by: Thiago Ribeiro <thiagitosouza@gmail.com>
Showing
14 changed files
with
81 additions
and
71 deletions
Show diff stats
src/noosfero-spb/gov_user/controllers/gov_user_plugin_controller.rb
@@ -65,7 +65,9 @@ class GovUserPluginController < ApplicationController | @@ -65,7 +65,9 @@ class GovUserPluginController < ApplicationController | ||
65 | def get_institutions | 65 | def get_institutions |
66 | redirect_to "/" if !request.xhr? || params[:query].blank? | 66 | redirect_to "/" if !request.xhr? || params[:query].blank? |
67 | 67 | ||
68 | + selected_institutions = Institution.where(id: params[:selected_institutions]).select([:id, :name]) | ||
68 | institutions = Institution.search_institution(params[:query]).select([:id, :name]) | 69 | institutions = Institution.search_institution(params[:query]).select([:id, :name]) |
70 | + institutions -= selected_institutions | ||
69 | institutions_list = institutions.map { |institution| | 71 | institutions_list = institutions.map { |institution| |
70 | {:value=>institution.name, :id=>institution.id} | 72 | {:value=>institution.name, :id=>institution.id} |
71 | } | 73 | } |
src/noosfero-spb/gov_user/features/institution_registration.feature
@@ -5,9 +5,12 @@ Feature: Institution Field | @@ -5,9 +5,12 @@ Feature: Institution Field | ||
5 | 5 | ||
6 | Background: | 6 | Background: |
7 | Given "GovUserPlugin" plugin is enabled | 7 | Given "GovUserPlugin" plugin is enabled |
8 | + And "SoftwareCommunitiesPlugin" plugin is enabled | ||
8 | And I am logged in as mpog_admin | 9 | And I am logged in as mpog_admin |
10 | + And I go to /admin/environment_themes/set/noosfero-spb-theme | ||
9 | And I go to /admin/plugins | 11 | And I go to /admin/plugins |
10 | And I check "GovUserPlugin" | 12 | And I check "GovUserPlugin" |
13 | + And I check "SoftwareCommunitiesPlugin" | ||
11 | And I press "Save changes" | 14 | And I press "Save changes" |
12 | And Institutions has initial default values on database | 15 | And Institutions has initial default values on database |
13 | And I am logged in as mpog_admin | 16 | And I am logged in as mpog_admin |
@@ -27,6 +30,6 @@ Feature: Institution Field | @@ -27,6 +30,6 @@ Feature: Institution Field | ||
27 | And I should see "CNPJ" | 30 | And I should see "CNPJ" |
28 | And I should see "Acronym" | 31 | And I should see "Acronym" |
29 | And I choose "Public Institution" | 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,7 +38,7 @@ Feature: rate_community | ||
38 | And I go to mycommunity's control panel | 38 | And I go to mycommunity's control panel |
39 | And I follow "Process requests" within ".pending-tasks" | 39 | And I follow "Process requests" within ".pending-tasks" |
40 | And I choose "Accept" within ".task_decisions" | 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 | Scenario: do not display message on task when a rating with the same institution does not exist on the same software | 43 | Scenario: do not display message on task when a rating with the same institution does not exist on the same software |
44 | Given the following organization ratings | 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,6 +8,7 @@ Feature: Create institution on user report | ||
8 | And "SoftwareCommunitiesPlugin" plugin is enabled | 8 | And "SoftwareCommunitiesPlugin" plugin is enabled |
9 | And "OrganizationRatings" plugin is enabled | 9 | And "OrganizationRatings" plugin is enabled |
10 | And I am logged in as mpog_admin | 10 | And I am logged in as mpog_admin |
11 | + And I go to /admin/environment_themes/set/noosfero-spb-theme | ||
11 | And I go to /admin/plugins | 12 | And I go to /admin/plugins |
12 | And I check "GovUserPlugin" | 13 | And I check "GovUserPlugin" |
13 | And I check "SoftwareCommunitiesPlugin" | 14 | And I check "SoftwareCommunitiesPlugin" |
@@ -23,20 +24,20 @@ Feature: Create institution on user report | @@ -23,20 +24,20 @@ Feature: Create institution on user report | ||
23 | And I should not see "Number of Beneficiaries" | 24 | And I should not see "Number of Beneficiaries" |
24 | And I should not see "Saved resources" | 25 | And I should not see "Saved resources" |
25 | And I should not see "Organization name or Enterprise name" | 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 | @selenium | 32 | @selenium |
32 | Scenario: Show new institution fields when clicked in add new institution | 33 | Scenario: Show new institution fields when clicked in add new institution |
33 | Given I go to /profile/noosfero/plugin/organization_ratings/new_rating | 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 | And I fill in "input_institution" with "None institution" | 37 | And I fill in "input_institution" with "None institution" |
36 | And I sleep for 2 seconds | 38 | And I sleep for 2 seconds |
37 | When I follow "Add" | 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 | And I should see "Private Institution" | 41 | And I should see "Private Institution" |
41 | And I should see "Corporate Name" | 42 | And I should see "Corporate Name" |
42 | And I should see "Name" | 43 | And I should see "Name" |
@@ -46,33 +47,30 @@ Feature: Create institution on user report | @@ -46,33 +47,30 @@ Feature: Create institution on user report | ||
46 | And I should see "CNPJ" | 47 | And I should see "CNPJ" |
47 | And I should see "Acronym" | 48 | And I should see "Acronym" |
48 | And I choose "Public Institution" | 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 | @selenium | 54 | @selenium |
54 | Scenario: Create new institution with name changed in the modal | 55 | Scenario: Create new institution with name changed in the modal |
55 | Given I go to /profile/noosfero/plugin/organization_ratings/new_rating | 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 | And I fill in "input_institution" with "None institution" | 59 | And I fill in "input_institution" with "None institution" |
58 | And I sleep for 2 seconds | 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 | And I fill in "community_name" with "Noosfero Institution" | 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 | Then I should see "Noosfero Institution" | 66 | Then I should see "Noosfero Institution" |
64 | 67 | ||
65 | @selenium | 68 | @selenium |
66 | Scenario: Check new institution name in the modal | 69 | Scenario: Check new institution name in the modal |
67 | Given I go to /profile/noosfero/plugin/organization_ratings/new_rating | 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 | And I fill in "input_institution" with "None institution" | 73 | And I fill in "input_institution" with "None institution" |
70 | And I sleep for 2 seconds | 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,12 +5,15 @@ Feature: Institution Field | ||
5 | 5 | ||
6 | Background: | 6 | Background: |
7 | Given "GovUserPlugin" plugin is enabled | 7 | Given "GovUserPlugin" plugin is enabled |
8 | + And "SoftwareCommunitiesPlugin" plugin is enabled | ||
8 | And the following users | 9 | And the following users |
9 | | login | name | | 10 | | login | name | |
10 | | joao | Joao Silva | | 11 | | joao | Joao Silva | |
11 | And I am logged in as admin | 12 | And I am logged in as admin |
13 | + And I go to /admin/environment_themes/set/noosfero-spb-theme | ||
12 | And I go to /admin/plugins | 14 | And I go to /admin/plugins |
13 | And I check "GovUserPlugin" | 15 | And I check "GovUserPlugin" |
16 | + And I check "SoftwareCommunitiesPlugin" | ||
14 | And I press "Save changes" | 17 | And I press "Save changes" |
15 | And feature "skip_new_user_email_confirmation" is enabled on environment | 18 | And feature "skip_new_user_email_confirmation" is enabled on environment |
16 | And I go to /admin/features/manage_fields | 19 | And I go to /admin/features/manage_fields |
@@ -25,12 +28,12 @@ Feature: Institution Field | @@ -25,12 +28,12 @@ Feature: Institution Field | ||
25 | | Governo do DF | GDF | BR | DF | Taguatinga | 12.645.166/0001-44 | Autarquia | Legislativo | Federal | Governo do DF | | 28 | | Governo do DF | GDF | BR | DF | Taguatinga | 12.645.166/0001-44 | Autarquia | Legislativo | Federal | Governo do DF | |
26 | | Ministerio do Planejamento | MP | BR | DF | Brasilia | 41.769.591/0001-43 | Autarquia | Judiciario | Federal | Ministerio do Planejamento | | 29 | | Ministerio do Planejamento | MP | BR | DF | Brasilia | 41.769.591/0001-43 | Autarquia | Judiciario | Federal | Ministerio do Planejamento | |
27 | 30 | ||
31 | + @selenium | ||
28 | Scenario: Go to control panel when clicked on 'Complete your profile' link | 32 | Scenario: Go to control panel when clicked on 'Complete your profile' link |
29 | Given I am logged in as "joao" | 33 | Given I am logged in as "joao" |
30 | And I am on joao's control panel | 34 | And I am on joao's control panel |
31 | When I follow "Complete your profile" | 35 | When I follow "Complete your profile" |
32 | Then I should see "Profile settings for " | 36 | Then I should see "Profile settings for " |
33 | - And I should see "Personal information" | ||
34 | 37 | ||
35 | @selenium | 38 | @selenium |
36 | Scenario: Verify text information to use governmental e-mail | 39 | Scenario: Verify text information to use governmental e-mail |
@@ -44,13 +47,12 @@ Feature: Institution Field | @@ -44,13 +47,12 @@ Feature: Institution Field | ||
44 | Given I am logged in as "joao" | 47 | Given I am logged in as "joao" |
45 | And I am on joao's control panel | 48 | And I am on joao's control panel |
46 | When I follow "Edit Profile" | 49 | When I follow "Edit Profile" |
47 | - And I follow "Add new institution" | ||
48 | And I type in "Minis" in autocomplete list "#input_institution" and I choose "Ministerio do Planejamento" | 50 | And I type in "Minis" in autocomplete list "#input_institution" and I choose "Ministerio do Planejamento" |
49 | - And I follow "Add new institution" | 51 | + And I follow "Add institution" |
50 | And I type in "Gover" in autocomplete list "#input_institution" and I choose "Governo do DF" | 52 | And I type in "Gover" in autocomplete list "#input_institution" and I choose "Governo do DF" |
51 | - 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" | 53 | + And I follow "Add institution" |
54 | + Then I should see "Ministerio do Planejamento" | ||
55 | + And I should see "Governo do DF" | ||
54 | 56 | ||
55 | @selenium | 57 | @selenium |
56 | Scenario: Verify if field 'city' is shown when Brazil is selected | 58 | Scenario: Verify if field 'city' is shown when Brazil is selected |
@@ -75,3 +77,14 @@ Feature: Institution Field | @@ -75,3 +77,14 @@ Feature: Institution Field | ||
75 | And I fill in "input_institution" with "Some Nonexistent Institution" | 77 | And I fill in "input_institution" with "Some Nonexistent Institution" |
76 | And I sleep for 1 seconds | 78 | And I sleep for 1 seconds |
77 | Then I should see "No institution found" | 79 | Then I should see "No institution found" |
80 | + | ||
81 | + @selenium | ||
82 | + Scenario: Does not suggest institution that already exists | ||
83 | + Given I am logged in as "joao" | ||
84 | + And I am on joao's control panel | ||
85 | + When I follow "Edit Profile" | ||
86 | + And I type in "Minis" in autocomplete list "#input_institution" and I choose "Ministerio do Planejamento" | ||
87 | + And I follow "Add institution" | ||
88 | + And I fill in "input_institution" with "Minis" | ||
89 | + And I sleep for 1 seconds | ||
90 | + Then I should not see "Ministerio do Planejamento" within "ul.ui-autocomplete" |
src/noosfero-spb/gov_user/lib/private_institution.rb
1 | class PrivateInstitution < Institution | 1 | class PrivateInstitution < Institution |
2 | validates :cnpj, | 2 | validates :cnpj, |
3 | - :presence=>true, | ||
4 | :format => {with: CNPJ_FORMAT}, | 3 | :format => {with: CNPJ_FORMAT}, |
5 | :if => :is_a_brazilian_institution? | 4 | :if => :is_a_brazilian_institution? |
6 | 5 | ||
7 | validates :cnpj, | 6 | validates :cnpj, |
8 | - :uniqueness=>true, :unless => 'cnpj.blank?' | 7 | + :uniqueness => true, :unless => 'cnpj.blank?' |
9 | 8 | ||
10 | private | 9 | private |
11 | def is_a_brazilian_institution? | 10 | def is_a_brazilian_institution? |
src/noosfero-spb/gov_user/lib/public_institution.rb
1 | class PublicInstitution < Institution | 1 | class PublicInstitution < Institution |
2 | validates :governmental_power, :governmental_sphere, :juridical_nature, | 2 | validates :governmental_power, :governmental_sphere, :juridical_nature, |
3 | - :presence=>true | 3 | + :presence=>true, :unless=>lambda{self.community.country != "BR"} |
4 | 4 | ||
5 | validates :cnpj, | 5 | validates :cnpj, |
6 | :format => {with: CNPJ_FORMAT}, | 6 | :format => {with: CNPJ_FORMAT}, |
src/noosfero-spb/gov_user/public/views/create-institution.js
@@ -202,12 +202,13 @@ modulejs.define('CreateInstitution', ['jquery', 'NoosferoRoot', 'SelectElement'] | @@ -202,12 +202,13 @@ modulejs.define('CreateInstitution', ['jquery', 'NoosferoRoot', 'SelectElement'] | ||
202 | $.ajax({ | 202 | $.ajax({ |
203 | type: "GET", | 203 | type: "GET", |
204 | url: AJAX_URL.get_institutions, | 204 | url: AJAX_URL.get_institutions, |
205 | - data: {query: request.term}, | 205 | + data: {query: request.term, selected_institutions: get_selected_institutions()}, |
206 | success: function(result){ | 206 | success: function(result){ |
207 | response(result); | 207 | response(result); |
208 | 208 | ||
209 | if( result.length === 0 ) { | 209 | if( result.length === 0 ) { |
210 | $('#institution_empty_ajax_message').switchClass("hide-field", "show-field"); | 210 | $('#institution_empty_ajax_message').switchClass("hide-field", "show-field"); |
211 | + $('#add_institution_link').hide(); | ||
211 | toggle_extra_fields_style_status(true); | 212 | toggle_extra_fields_style_status(true); |
212 | $("#institution_modal").css({display: "none"}); | 213 | $("#institution_modal").css({display: "none"}); |
213 | } | 214 | } |
@@ -222,12 +223,22 @@ modulejs.define('CreateInstitution', ['jquery', 'NoosferoRoot', 'SelectElement'] | @@ -222,12 +223,22 @@ modulejs.define('CreateInstitution', ['jquery', 'NoosferoRoot', 'SelectElement'] | ||
222 | 223 | ||
223 | select : function (event, selected) { | 224 | select : function (event, selected) { |
224 | $('#institution_empty_ajax_message').switchClass("show-field", "hide-field"); | 225 | $('#institution_empty_ajax_message').switchClass("show-field", "hide-field"); |
225 | - //$("#create_institution_link").remove(); | 226 | + $('#add_institution_link').show(); |
226 | toggle_extra_fields_style_status(false); | 227 | toggle_extra_fields_style_status(false); |
227 | $("#institution_selected").val(selected.item.id).attr("data-name", selected.item.label); | 228 | $("#institution_selected").val(selected.item.id).attr("data-name", selected.item.label); |
228 | } | 229 | } |
229 | }); | 230 | }); |
230 | } | 231 | } |
232 | + | ||
233 | + function get_selected_institutions() { | ||
234 | + var selected_institutions = [] | ||
235 | + $('.institutions_added').find('li').each(function() { | ||
236 | + selected_institutions.push($(this).attr('data-institution')); | ||
237 | + }); | ||
238 | + | ||
239 | + return selected_institutions; | ||
240 | + } | ||
241 | + | ||
231 | function add_selected_institution_to_list(id, name) { | 242 | function add_selected_institution_to_list(id, name) { |
232 | var selected_institution = "<li data-institution='"+id+"'>"+name; | 243 | var selected_institution = "<li data-institution='"+id+"'>"+name; |
233 | selected_institution += "<a href='#' class='button without-text icon-remove remove-institution'></a></li>"; | 244 | selected_institution += "<a href='#' class='button without-text icon-remove remove-institution'></a></li>"; |
@@ -246,6 +257,7 @@ modulejs.define('CreateInstitution', ['jquery', 'NoosferoRoot', 'SelectElement'] | @@ -246,6 +257,7 @@ modulejs.define('CreateInstitution', ['jquery', 'NoosferoRoot', 'SelectElement'] | ||
246 | 257 | ||
247 | // Visualy add the selected institution to the list | 258 | // Visualy add the selected institution to the list |
248 | add_selected_institution_to_list(selected.val(), selected.attr("data-name")); | 259 | add_selected_institution_to_list(selected.val(), selected.attr("data-name")); |
260 | + $(this).hide(); | ||
249 | 261 | ||
250 | // clean the institution flag | 262 | // clean the institution flag |
251 | selected.val("").attr("data-name", ""); | 263 | selected.val("").attr("data-name", ""); |
@@ -311,7 +323,6 @@ modulejs.define('CreateInstitution', ['jquery', 'NoosferoRoot', 'SelectElement'] | @@ -311,7 +323,6 @@ modulejs.define('CreateInstitution', ['jquery', 'NoosferoRoot', 'SelectElement'] | ||
311 | var divisor_option = SelectElement.generateOption("-1", "--------------------------------"); | 323 | var divisor_option = SelectElement.generateOption("-1", "--------------------------------"); |
312 | var default_option = SelectElement.generateOption("BR", "Brazil"); | 324 | var default_option = SelectElement.generateOption("BR", "Brazil"); |
313 | 325 | ||
314 | - | ||
315 | var inst_type = $("input[name='institutions[type]']:checked").val(); | 326 | var inst_type = $("input[name='institutions[type]']:checked").val(); |
316 | var country = $("#community_country").val(); | 327 | var country = $("#community_country").val(); |
317 | 328 | ||
@@ -323,6 +334,10 @@ modulejs.define('CreateInstitution', ['jquery', 'NoosferoRoot', 'SelectElement'] | @@ -323,6 +334,10 @@ modulejs.define('CreateInstitution', ['jquery', 'NoosferoRoot', 'SelectElement'] | ||
323 | $('#community_country').prepend(divisor_option); | 334 | $('#community_country').prepend(divisor_option); |
324 | $('#community_country').prepend(default_option); | 335 | $('#community_country').prepend(default_option); |
325 | 336 | ||
337 | + if ($('#add_institution_link').length > 0) { | ||
338 | + $('#add_institution_link').hide(); | ||
339 | + } | ||
340 | + | ||
326 | if($("#edit_institution_page").val() === "false") { | 341 | if($("#edit_institution_page").val() === "false") { |
327 | $('#community_country').val("BR"); | 342 | $('#community_country').val("BR"); |
328 | show_hide_cnpj_city($('#community_country').val()); | 343 | show_hide_cnpj_city($('#community_country').val()); |
@@ -379,7 +394,7 @@ modulejs.define('CreateInstitution', ['jquery', 'NoosferoRoot', 'SelectElement'] | @@ -379,7 +394,7 @@ modulejs.define('CreateInstitution', ['jquery', 'NoosferoRoot', 'SelectElement'] | ||
379 | 394 | ||
380 | $("#community_name").keyup(institution_already_exists); | 395 | $("#community_name").keyup(institution_already_exists); |
381 | 396 | ||
382 | - $("#add_new_institution").click(add_new_institution); | 397 | + $("#add_institution_link").click(add_new_institution); |
383 | 398 | ||
384 | $(".remove-institution").click(remove_institution); | 399 | $(".remove-institution").click(remove_institution); |
385 | 400 |
src/noosfero-spb/gov_user/test/functional/gov_user_plugin_controller_test.rb
@@ -105,9 +105,9 @@ class GovUserPluginControllerTest < ActionController::TestCase | @@ -105,9 +105,9 @@ class GovUserPluginControllerTest < ActionController::TestCase | ||
105 | 105 | ||
106 | fields = InstitutionTestHelper.generate_form_fields( | 106 | fields = InstitutionTestHelper.generate_form_fields( |
107 | "Some Private Institution", | 107 | "Some Private Institution", |
108 | - "BR", | ||
109 | - "DF", | ||
110 | - "Brasilia", | 108 | + "EN", |
109 | + "NY", | ||
110 | + "New York", | ||
111 | "", | 111 | "", |
112 | "PrivateInstitution" | 112 | "PrivateInstitution" |
113 | ) | 113 | ) |
src/noosfero-spb/gov_user/test/unit/gov_user_person_test.rb
@@ -14,7 +14,6 @@ class SoftwareCommunitiesPluginPersonTest < ActiveSupport::TestCase | @@ -14,7 +14,6 @@ class SoftwareCommunitiesPluginPersonTest < ActiveSupport::TestCase | ||
14 | "My Name", | 14 | "My Name", |
15 | "user@email.com", | 15 | "user@email.com", |
16 | "123456", | 16 | "123456", |
17 | - "123456", | ||
18 | "user2@email.com", | 17 | "user2@email.com", |
19 | "Any State", | 18 | "Any State", |
20 | "Some City" | 19 | "Some City" |
src/noosfero-spb/gov_user/test/unit/organization_rating_test.rb
@@ -16,15 +16,14 @@ class OrganizationRatingTest < ActiveSupport::TestCase | @@ -16,15 +16,14 @@ class OrganizationRatingTest < ActiveSupport::TestCase | ||
16 | private_institution = build_private_institution "huehue", "hue", "11.222.333/4444-55" | 16 | private_institution = build_private_institution "huehue", "hue", "11.222.333/4444-55" |
17 | 17 | ||
18 | community_rating = OrganizationRating.new(:person => person, :value => 3, :organization => community, :institution => private_institution) | 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 | private_institution.save | 22 | private_institution.save |
24 | community_rating.institution = private_institution | 23 | community_rating.institution = private_institution |
25 | 24 | ||
26 | assert_equal true, community_rating.valid? | 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 | end | 27 | end |
29 | 28 | ||
30 | private | 29 | private |
src/noosfero-spb/gov_user/views/person_editor_extras.html.erb
@@ -3,6 +3,7 @@ | @@ -3,6 +3,7 @@ | ||
3 | 3 | ||
4 | <div class="institution_container"> | 4 | <div class="institution_container"> |
5 | <%= text_field_tag(:institution, "", :id=>"input_institution") %> | 5 | <%= text_field_tag(:institution, "", :id=>"input_institution") %> |
6 | + <%= link_to(_("Add institution"), "#", :class=>'button with-text icon-add', :id => 'add_institution_link') %> | ||
6 | 7 | ||
7 | <% context.profile.user.institutions.each do |institution| %> | 8 | <% context.profile.user.institutions.each do |institution| %> |
8 | <%= hidden_field_tag("user[institution_ids][]", institution.id, :class => 'user_institutions') %> | 9 | <%= hidden_field_tag("user[institution_ids][]", institution.id, :class => 'user_institutions') %> |
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,29 +18,6 @@ Given /^SoftwareInfo has initial default values on database$/ do | ||
18 | OperatingSystemName.create(:name=>"CentOS") | 18 | OperatingSystemName.create(:name=>"CentOS") |
19 | end | 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 | Given /^I type in "([^"]*)" in autocomplete list "([^"]*)" and I choose "([^"]*)"$/ do |typed, input_field_selector, should_select| | 21 | Given /^I type in "([^"]*)" in autocomplete list "([^"]*)" and I choose "([^"]*)"$/ do |typed, input_field_selector, should_select| |
45 | # Wait the page javascript load | 22 | # Wait the page javascript load |
46 | sleep 1 | 23 | sleep 1 |
@@ -297,6 +274,10 @@ Then /^there should be (\d+) divs? with class "([^"]*)"$/ do |count, klass| | @@ -297,6 +274,10 @@ Then /^there should be (\d+) divs? with class "([^"]*)"$/ do |count, klass| | ||
297 | should have_selector("div.#{klass}", :count => count) | 274 | should have_selector("div.#{klass}", :count => count) |
298 | end | 275 | end |
299 | 276 | ||
277 | +Then /^I should see "([^"]*)" in "([^"]*)" field$/ do |content, field| | ||
278 | + should have_field(field, :with => content) | ||
279 | +end | ||
280 | + | ||
300 | Given /^I should see "([^"]*)" in the page/ do |message| | 281 | Given /^I should see "([^"]*)" in the page/ do |message| |
301 | assert_match message, page.body | 282 | assert_match message, page.body |
302 | end | 283 | end |
src/noosfero-spb/software_communities/test/unit/software_info_test.rb
@@ -52,7 +52,7 @@ class SoftwareInfoValidationTest < ActiveSupport::TestCase | @@ -52,7 +52,7 @@ class SoftwareInfoValidationTest < ActiveSupport::TestCase | ||
52 | assert_equal 1, SoftwareInfo.search_by_query("", Environment.default).count | 52 | assert_equal 1, SoftwareInfo.search_by_query("", Environment.default).count |
53 | assert_equal software_info, SoftwareInfo.search_by_query("", Environment.default).first | 53 | assert_equal software_info, SoftwareInfo.search_by_query("", Environment.default).first |
54 | assert_equal 1, SoftwareInfo.search_by_query("", other_env).count | 54 | assert_equal 1, SoftwareInfo.search_by_query("", other_env).count |
55 | - assert_equal true, SoftwareInfo.search_by_query("", other_env).include?(another_software_info) | 55 | + assert_equal true, SoftwareInfo.search_by_query("", other_env).all.include?(another_software_info) |
56 | end | 56 | end |
57 | 57 | ||
58 | should "start another license with default values" do | 58 | should "start another license with default values" do |