Commit 82e72b86211dc0ff0ee2828cfc4df997311e3cc5
1 parent
a2bcc1d0
Exists in
gov-user-to-organization
and in
1 other branch
fixes unit and functional tests
Showing
18 changed files
with
40 additions
and
51 deletions
Show diff stats
src/noosfero-spb/gov_user/controllers/gov_user_plugin_controller.rb
... | ... | @@ -67,7 +67,7 @@ class GovUserPluginController < ApplicationController |
67 | 67 | redirect_to "/" if !request.xhr? || params[:query].blank? |
68 | 68 | |
69 | 69 | selected_institutions = GovUserPlugin::Institution.where(id: params[:selected_institutions]).select([:id, :name]) |
70 | - institutions = GovUserPlugin::Institution.search_institution(params[:query], environment).select("institutions.id, institutions.name") | |
70 | + institutions = GovUserPlugin::Institution.search_institution(params[:query], environment).select("gov_user_plugin_institutions.id, gov_user_plugin_institutions.name") | |
71 | 71 | institutions -= selected_institutions |
72 | 72 | institutions_list = institutions.map { |institution| |
73 | 73 | {:value=>institution.name, :id=>institution.id} | ... | ... |
src/noosfero-spb/gov_user/lib/ext/search_controller.rb
... | ... | @@ -2,18 +2,6 @@ require_dependency 'search_controller' |
2 | 2 | |
3 | 3 | class SearchController |
4 | 4 | |
5 | - def communities | |
6 | - @titles[:communities] = _("Communities Search") | |
7 | - delete_communities = [] | |
8 | - valid_communities_string = Community.get_valid_communities_string | |
9 | - Community.all.each{|community| delete_communities << community.id unless eval(valid_communities_string)} | |
10 | - | |
11 | - @scope = visible_profiles(Community) | |
12 | - @scope = @scope.where(["id NOT IN (?)", delete_communities]) unless delete_communities.empty? | |
13 | - | |
14 | - full_text_search | |
15 | - end | |
16 | - | |
17 | 5 | def institutions |
18 | 6 | @titles[:institutions] = _("Institutions Search") |
19 | 7 | results = filter_communities_list{|community| community.institution?} | ... | ... |
src/noosfero-spb/gov_user/test/functional/gov_user_plugin_controller_test.rb
1 | -require_relative '../../../../test/test_helper' | |
2 | -require_relative '../helpers/institution_test_helper' | |
1 | +require 'test_helper' | |
2 | +require_relative '../helpers/plugin_test_helper' | |
3 | 3 | require_relative '../../controllers/gov_user_plugin_controller' |
4 | 4 | |
5 | 5 | class GovUserPluginController; def rescue_action(e) raise e end; end |
... | ... | @@ -124,12 +124,12 @@ class GovUserPluginControllerTest < ActionController::TestCase |
124 | 124 | @controller.stubs(:verify_recaptcha).returns(true) |
125 | 125 | |
126 | 126 | fields = InstitutionTestHelper.generate_form_fields( |
127 | - "Some Private Institution", | |
127 | + "Some Public Institution", | |
128 | 128 | "BR", |
129 | 129 | "Distrito Federal", |
130 | 130 | "Brasilia", |
131 | 131 | "56.366.790/0001-88", |
132 | - "PublicInstitution" | |
132 | + "GovUserPlugin::PublicInstitution" | |
133 | 133 | ) |
134 | 134 | fields[:institutions][:governmental_power] = @gov_power.id |
135 | 135 | fields[:institutions][:governmental_sphere] = @gov_sphere.id | ... | ... |
src/noosfero-spb/gov_user/test/functional/gov_user_plugin_myprofile_controller.rb
1 | -require_relative '../../../../test/test_helper' | |
2 | -require_relative '../helpers/institution_test_helper' | |
1 | +require 'test_helper' | |
2 | +require_relative '../helpers/plugin_test_helper' | |
3 | 3 | require_relative '../../controllers/gov_user_plugin_myprofile_controller' |
4 | 4 | |
5 | 5 | class GovUserPluginMyprofileController; def rescue_action(e) raise e end; |
... | ... | @@ -17,7 +17,7 @@ class GovUserPluginMyprofileControllerTest < ActionController::TestCase |
17 | 17 | |
18 | 18 | gov_power = GovUserPlugin::GovernmentalPower.create(:name=>"Some Gov Power") |
19 | 19 | gov_sphere = GovUserPlugin::GovernmentalSphere.create(:name=>"Some Gov Sphere") |
20 | - juridical_nature = JuridicalNature.create(:name => "Autarquia") | |
20 | + juridical_nature = GovUserPlugin::JuridicalNature.create(:name => "Autarquia") | |
21 | 21 | @institution = InstitutionTestHelper.create_public_institution( |
22 | 22 | "Ministerio Publico da Uniao", |
23 | 23 | "MPU", | ... | ... |
src/noosfero-spb/gov_user/test/functional/profile_editor_controller_test.rb
1 | -require_relative '../../../../test/test_helper' | |
2 | -require_relative '../helpers/institution_test_helper' | |
3 | -require_relative '../../../../app/controllers/my_profile/profile_editor_controller' | |
1 | +require 'test_helper' | |
2 | +require_relative '../helpers/plugin_test_helper' | |
3 | +require File.dirname(__FILE__) + '/../../../../app/controllers/my_profile/profile_editor_controller' | |
4 | + | |
4 | 5 | |
5 | 6 | class ProfileEditorController; def rescue_action(e) raise e end; end |
6 | 7 | ... | ... |
src/noosfero-spb/gov_user/test/functional/search_controller_test.rb
1 | -require_relative '../../../../test/test_helper' | |
1 | +require 'test_helper' | |
2 | 2 | require_relative '../helpers/plugin_test_helper' |
3 | -require_relative '../../../../app/controllers/public/search_controller' | |
3 | +require File.dirname(__FILE__) + '/../../../../app/controllers/public/search_controller' | |
4 | 4 | |
5 | 5 | class SearchController; def rescue_action(e) raise e end; end |
6 | 6 | ... | ... |
src/noosfero-spb/gov_user/test/unit/communities_block.rb
1 | -require File.dirname(__FILE__) + '/../../../../test/test_helper' | |
2 | -require File.dirname(__FILE__) + '/../helpers/institution_test_helper' | |
1 | +require 'test_helper' | |
2 | +require_relative '../helpers/plugin_test_helper' | |
3 | 3 | |
4 | 4 | class CommunitiesBlockTest < ActiveSupport::TestCase |
5 | 5 | def setup | ... | ... |
src/noosfero-spb/gov_user/test/unit/gov_user_person_test.rb
src/noosfero-spb/gov_user/test/unit/gov_user_plugin_api_test.rb
src/noosfero-spb/gov_user/test/unit/gov_user_plugin_test.rb
1 | -require File.dirname(__FILE__) + '/../../../../test/test_helper' | |
2 | -require File.dirname(__FILE__) + '/../helpers/plugin_test_helper' | |
1 | +require 'test_helper' | |
2 | +require_relative '../helpers/plugin_test_helper' | |
3 | 3 | |
4 | 4 | class GovUserPluginTest < ActiveSupport::TestCase |
5 | 5 | include PluginTestHelper |
... | ... | @@ -13,7 +13,7 @@ class GovUserPluginTest < ActiveSupport::TestCase |
13 | 13 | "Ministerio Publico da Uniao", |
14 | 14 | "MPU", |
15 | 15 | "BR", |
16 | - "DF", | |
16 | + "Distrito Federal", | |
17 | 17 | "Gama", |
18 | 18 | @juridical_nature, |
19 | 19 | @gov_power, | ... | ... |
src/noosfero-spb/gov_user/test/unit/governmental_power_test.rb
1 | -require File.dirname(__FILE__) + '/../../../../test/test_helper' | |
2 | -require File.dirname(__FILE__) + '/../helpers/institution_test_helper' | |
1 | +require 'test_helper' | |
2 | +require_relative '../helpers/plugin_test_helper' | |
3 | 3 | |
4 | 4 | class GovUserPlugin::GovernmentalPowerTest < ActiveSupport::TestCase |
5 | 5 | |
... | ... | @@ -20,7 +20,7 @@ class GovUserPlugin::GovernmentalPowerTest < ActiveSupport::TestCase |
20 | 20 | inst_name, |
21 | 21 | "MPU", |
22 | 22 | "BR", |
23 | - "DF", | |
23 | + "Distrito Federal", | |
24 | 24 | "Gama", |
25 | 25 | @juridical_nature, |
26 | 26 | gov_power, | ... | ... |
src/noosfero-spb/gov_user/test/unit/institution_test.rb
1 | -require File.dirname(__FILE__) + '/../../../../test/test_helper' | |
2 | -require File.dirname(__FILE__) + '/../helpers/plugin_test_helper' | |
1 | +require 'test_helper' | |
2 | +require_relative '../helpers/plugin_test_helper' | |
3 | 3 | |
4 | 4 | class GovUserPlugin::InstitutionTest < ActiveSupport::TestCase |
5 | 5 | include PluginTestHelper | ... | ... |
src/noosfero-spb/gov_user/test/unit/institutions_organization_ratings_test.rb
1 | -require File.dirname(__FILE__) + '/../../../../test/test_helper' | |
2 | -require File.dirname(__FILE__) + '/../helpers/plugin_test_helper' | |
1 | +require 'test_helper' | |
2 | +require_relative '../helpers/plugin_test_helper' | |
3 | 3 | |
4 | 4 | class GovUserPlugin::InstitutionsOrganizationRatingsTest < ActiveSupport::TestCase |
5 | 5 | include PluginTestHelper | ... | ... |
src/noosfero-spb/gov_user/test/unit/juridical_nature_test.rb
1 | -require File.dirname(__FILE__) + '/../../../../test/test_helper' | |
2 | -require File.dirname(__FILE__) + '/../helpers/plugin_test_helper' | |
1 | +require 'test_helper' | |
2 | +require_relative '../helpers/plugin_test_helper' | |
3 | 3 | |
4 | 4 | class GovUserPlugin::JuridicalNatureTest < ActiveSupport::TestCase |
5 | 5 | |
... | ... | @@ -16,8 +16,8 @@ class GovUserPlugin::JuridicalNatureTest < ActiveSupport::TestCase |
16 | 16 | |
17 | 17 | should "get public institutions" do |
18 | 18 | juridical_nature = GovUserPlugin::JuridicalNature.create(:name => "Autarquia") |
19 | - create_public_institution("Ministerio Publico da Uniao", "MPU", "BR", "DF", "Gama", juridical_nature, @govPower, @govSphere, "22.333.444/5555-66") | |
20 | - create_public_institution("Tribunal Regional da Uniao", "TRU", "BR", "DF", "Brasilia", juridical_nature, @govPower, @govSphere, "22.333.444/5555-77") | |
19 | + create_public_institution("Ministerio Publico da Uniao", "MPU", "BR", "Distrito Federal", "Gama", juridical_nature, @govPower, @govSphere, "22.333.444/5555-66") | |
20 | + create_public_institution("Tribunal Regional da Uniao", "TRU", "BR", "Distrito Federal", "Brasilia", juridical_nature, @govPower, @govSphere, "22.333.444/5555-77") | |
21 | 21 | assert juridical_nature.institutions.public_institutions.count == GovUserPlugin::PublicInstitution.count |
22 | 22 | end |
23 | 23 | end | ... | ... |
src/noosfero-spb/gov_user/test/unit/person_test.rb
1 | -require File.dirname(__FILE__) + '/../../../../test/test_helper' | |
2 | -require File.dirname(__FILE__) + '/../helpers/plugin_test_helper' | |
1 | +require 'test_helper' | |
2 | +require_relative '../helpers/plugin_test_helper' | |
3 | 3 | |
4 | 4 | class GovUserPluginPersonTest < ActiveSupport::TestCase |
5 | 5 | include PluginTestHelper | ... | ... |
src/noosfero-spb/gov_user/test/unit/private_institution_test.rb
1 | -require File.dirname(__FILE__) + '/../../../../test/test_helper' | |
2 | -require File.dirname(__FILE__) + '/../helpers/plugin_test_helper' | |
1 | +require 'test_helper' | |
2 | +require_relative '../helpers/plugin_test_helper' | |
3 | 3 | |
4 | 4 | class GovUserPlugin::PrivateInstitutionTest < ActiveSupport::TestCase |
5 | 5 | include PluginTestHelper | ... | ... |
src/noosfero-spb/gov_user/test/unit/public_institution_test.rb
1 | -require File.dirname(__FILE__) + '/../../../../test/test_helper' | |
2 | -require File.dirname(__FILE__) + '/../helpers/plugin_test_helper' | |
1 | +require 'test_helper' | |
2 | +require_relative '../helpers/plugin_test_helper' | |
3 | 3 | |
4 | 4 | class GovUserPlugin::PublicInstitutionTest < ActiveSupport::TestCase |
5 | 5 | include PluginTestHelper | ... | ... |
src/noosfero-spb/gov_user/test/unit/user_test.rb