Commit 4f66c14df550f4eded9d1ba23a2eec41ba19e7b2

Authored by Gabriela Navarro
Committed by David Silva
1 parent 133f6fa9
Exists in master and in 79 other branches add_sisp_to_chef, add_super_archives_plugin, api_for_colab, automates_core_packing, backup_not_prod, changes_in_buttons_on_content_panel, colab_automated_login, colab_spb_plugin_recipe, colab_widgets_settings, design_validation, dev_env_minimal, disable_email_dev, fix_breadcrumbs_position, fix_categories_software_link, fix_edit_institution, fix_edit_software_with_another_license, fix_get_license_info, fix_gitlab_assets_permission, fix_list_style_inside_article, fix_list_style_on_folder_elements, fix_members_pagination, fix_merge_request_url, fix_models_translations, fix_no_license, fix_software_api, fix_software_block_migration, fix_software_communities_translations, fix_software_communities_unit_test, fix_style_create_institution_admin_panel, fix_superarchives_imports, fix_sym_links_noosfero, focus_search_field_theme, gov-user-refactoring, gov-user-refactoring-rails4, header_fix, institution_modal_on_rating, kalibro-conf-refactoring, kalibro-processor-package, lxc_settings, margin_fix, mezuro_cookbook, prezento, refactor_download_block, refactor_software_communities, refactor_software_for_sisp, register_page, release-process, release-process-v2, remove-unused-images, remove_broken_theme, remove_secondary_email_from_user, remove_sisp_buttons, removing_super_archives_email, review_message, scope2method, signals_user_noosfero, sisp_catalog_header, sisp_colab_config, sisp_dev, sisp_dev_master, sisp_simple_version, software_as_organization, software_catalog_style_fix, software_communities_html_refactor, software_infos_api, spb_minimal_env, spb_to_rails4, spec_refactor, stable-4.1, stable-4.2, stable-4.x, temp_soft_comm_refactoring, theme_header, theme_javascript_refactory, thread_dropdown, thread_page, update_search_by_categories, update_software_api, update_softwares_boxes

Resizing lines of different files

Signed-off-by: Gabriela Navarro <navarro1703@gmail.com>
controllers/mpog_software_plugin_myprofile_controller.rb
@@ -60,7 +60,7 @@ class MpogSoftwarePluginMyprofileController &lt; MyProfileController @@ -60,7 +60,7 @@ class MpogSoftwarePluginMyprofileController &lt; MyProfileController
60 60
61 def community_must_be_approved 61 def community_must_be_approved
62 end 62 end
63 - 63 +
64 private 64 private
65 65
66 def add_software_erros 66 def add_software_erros
test/unit/database_helper_test.rb
@@ -27,12 +27,14 @@ class DatabaseHelperTest &lt; ActiveSupport::TestCase @@ -27,12 +27,14 @@ class DatabaseHelperTest &lt; ActiveSupport::TestCase
27 27
28 should "return a list with current database objects" do 28 should "return a list with current database objects" do
29 list_compare = [] 29 list_compare = []
30 - assert_equal list_compare.class, DatabaseHelper.list_database(@database_objects).class 30 + db_tables = DatabaseHelper.list_database(@database_objects)
  31 + assert_equal list_compare.class, db_tables.class
31 end 32 end
32 33
33 should "have same information from the list passed as parameter" do 34 should "have same information from the list passed as parameter" do
34 list_compare = DatabaseHelper.list_database(@database_objects) 35 list_compare = DatabaseHelper.list_database(@database_objects)
35 - assert_equal @database_objects.first[:database_description_id].to_i, list_compare.first.database_description_id 36 + db_objects_id = @database_objects.first[:database_description_id]
  37 + assert_equal db_objects_id.to_i, list_compare.first.database_description_id
36 end 38 end
37 39
38 should "return a list with the same size of the parameter" do 40 should "return a list with the same size of the parameter" do
@@ -57,8 +59,9 @@ class DatabaseHelperTest &lt; ActiveSupport::TestCase @@ -57,8 +59,9 @@ class DatabaseHelperTest &lt; ActiveSupport::TestCase
57 software_database.database_description = database_description 59 software_database.database_description = database_description
58 60
59 databases << software_database 61 databases << software_database
  62 + db_tables = DatabaseHelper.database_as_tables(databases)
60 63
61 - assert_not_nil DatabaseHelper.database_as_tables(databases).first.call.index("linux") 64 + assert_not_nil db_tables.first.call.index("linux")
62 end 65 end
63 66
64 should "remove invalid tables from the list" do 67 should "remove invalid tables from the list" do
test/unit/database_validation_test.rb
@@ -21,28 +21,28 @@ class DatabaseValidationTest &lt; ActiveSupport::TestCase @@ -21,28 +21,28 @@ class DatabaseValidationTest &lt; ActiveSupport::TestCase
21 assert_equal true, @database.save 21 assert_equal true, @database.save
22 end 22 end
23 23
24 - should "Don't save database if database_description database_description is empty" do 24 + should "not save database if database_description is empty" do
25 @database.database_description = nil 25 @database.database_description = nil
26 assert_equal true, !@database.save 26 assert_equal true, !@database.save
27 end 27 end
28 28
29 - should "Don't save database if operating system are empty" do 29 + should "not save database if operating system are empty" do
30 @database.operating_system = " " 30 @database.operating_system = " "
31 assert_equal true, !@database.save 31 assert_equal true, !@database.save
32 end 32 end
33 33
34 - should "Don't save database if version are empty" do 34 + should "not save database if version are empty" do
35 @database.version = " " 35 @database.version = " "
36 assert_equal true, !@database.save 36 assert_equal true, !@database.save
37 end 37 end
38 38
39 - should "Don't save database if version is too long" do 39 + should "not save database if version is too long" do
40 @database.version = "A too long version to be a valid version for database" 40 @database.version = "A too long version to be a valid version for database"
41 assert !@database.save 41 assert !@database.save
42 end 42 end
43 43
44 - should "Don't save database if operating system is too long" do  
45 - @database.operating_system = "A too long operating system to be a valid operating system for library" 44 + should "not save database if operating system is too long" do
  45 + @database.operating_system = "A too long operating system to be a valid db"
46 assert !@database.save 46 assert !@database.save
47 end 47 end
48 end 48 end
test/unit/governmental_power_test.rb
@@ -13,8 +13,20 @@ class GovernmentalPowerTest &lt; ActiveSupport::TestCase @@ -13,8 +13,20 @@ class GovernmentalPowerTest &lt; ActiveSupport::TestCase
13 end 13 end
14 14
15 should "get public institutions" do 15 should "get public institutions" do
16 - gov_power = GovernmentalPower::new :name=>"Some gov power"  
17 - InstitutionTestHelper.create_public_institution("Ministerio Publico da Uniao", "MPU", "BR", "DF", "Gama", @juridical_nature, gov_power, @gov_sphere, "12.345.678/9012-45") 16 + inst_name = "Ministerio Publico da Uniao"
  17 + inst_cnpj = "12.345.678/9012-45"
  18 + gov_power = GovernmentalPower.create(:name=>"Some gov power")
  19 + InstitutionTestHelper.create_public_institution(
  20 + inst_name,
  21 + "MPU",
  22 + "BR",
  23 + "DF",
  24 + "Gama",
  25 + @juridical_nature,
  26 + gov_power,
  27 + @gov_sphere,
  28 + inst_cnpj
  29 + )
18 30
19 assert_equal gov_power.public_institutions.count, PublicInstitution.count 31 assert_equal gov_power.public_institutions.count, PublicInstitution.count
20 end 32 end
test/unit/library_helper_test.rb
@@ -5,7 +5,8 @@ class LibraryHelperTest &lt; ActiveSupport::TestCase @@ -5,7 +5,8 @@ class LibraryHelperTest &lt; ActiveSupport::TestCase
5 include LibraryHelper 5 include LibraryHelper
6 6
7 def setup 7 def setup
8 - @license_objects = [{"name" => "license1" ,"version" => "2.0", "license" => "debian", "software_id" => "1"}, 8 + @license_objects = [
  9 + {"name" => "license1" ,"version" => "2.0", "license" => "debian", "software_id" => "1"},
9 {"name" => "license2" ,"version" => "2.1", "license" => "debian", "software_id" => "1"}, 10 {"name" => "license2" ,"version" => "2.1", "license" => "debian", "software_id" => "1"},
10 {"name" => "license3" ,"version" => "2.2", "license" => "debian", "software_id" => "1"}] 11 {"name" => "license3" ,"version" => "2.2", "license" => "debian", "software_id" => "1"}]
11 end 12 end
@@ -21,7 +22,8 @@ class LibraryHelperTest &lt; ActiveSupport::TestCase @@ -21,7 +22,8 @@ class LibraryHelperTest &lt; ActiveSupport::TestCase
21 22
22 should "return a list with current library objects" do 23 should "return a list with current library objects" do
23 list_compare = [] 24 list_compare = []
24 - assert_equal list_compare.class, LibraryHelper.list_libraries(@license_objects).class 25 + lib_table = LibraryHelper.list_libraries(@license_objects)
  26 + assert_equal list_compare.class, lib_table.class
25 end 27 end
26 28
27 should "have same information from the list passed as parameter" do 29 should "have same information from the list passed as parameter" do
@@ -46,7 +48,8 @@ class LibraryHelperTest &lt; ActiveSupport::TestCase @@ -46,7 +48,8 @@ class LibraryHelperTest &lt; ActiveSupport::TestCase
46 library_description.name = "Lib" 48 library_description.name = "Lib"
47 49
48 libraries << library_description 50 libraries << library_description
  51 + lib_table = LibraryHelper.library_as_tables(libraries)
49 52
50 - assert_not_nil LibraryHelper.library_as_tables(libraries).first.call.index("lib") 53 + assert_not_nil lib_table.first.call.index("lib")
51 end 54 end
52 end 55 end
test/unit/mpog_person_test.rb
@@ -11,7 +11,9 @@ class MpogSoftwarePluginPersonTest &lt; ActiveSupport::TestCase @@ -11,7 +11,9 @@ class MpogSoftwarePluginPersonTest &lt; ActiveSupport::TestCase
11 end 11 end
12 12
13 should 'save person with a valid full name with accents' do 13 should 'save person with a valid full name with accents' do
14 - p = Person::new :name=>'Jônatàs dâ Sîlvã Jösé', :identifier=>"jonatas-jose-da-silva" 14 + name = 'Jônatàs dâ Sîlvã Jösé'
  15 + identifier = "jonatas-jose-da-silva"
  16 + p = Person::new :name=>name, :identifier=>identifier
15 p.user = fast_create(:user) 17 p.user = fast_create(:user)
16 18
17 assert_equal true, p.save 19 assert_equal true, p.save
test/unit/mpog_software_plugin_test.rb
@@ -6,7 +6,15 @@ class MpogSoftwarePluginTest &lt; ActiveSupport::TestCase @@ -6,7 +6,15 @@ class MpogSoftwarePluginTest &lt; ActiveSupport::TestCase
6 6
7 def setup 7 def setup
8 @plugin = MpogSoftwarePlugin.new 8 @plugin = MpogSoftwarePlugin.new
9 - @person = create_person("My Name", "user@email.com", "123456", "123456", "user@secondary_email.com", "Any State", "Some City") 9 + @person = create_person(
  10 + "My Name",
  11 + "user@email.com",
  12 + "123456",
  13 + "123456",
  14 + "user@secondary_email.com",
  15 + "Any State",
  16 + "Some City"
  17 + )
10 end 18 end
11 19
12 def teardown 20 def teardown
test/unit/software_helper_test.rb
@@ -6,9 +6,11 @@ class SoftwareHelperTest &lt; ActiveSupport::TestCase @@ -6,9 +6,11 @@ class SoftwareHelperTest &lt; ActiveSupport::TestCase
6 6
7 should "Create ProgrammingLanguages based on file with languages names" do 7 should "Create ProgrammingLanguages based on file with languages names" do
8 ProgrammingLanguage.delete_all 8 ProgrammingLanguage.delete_all
9 - SoftwareHelper.create_list_with_file("plugins/mpog_software/public/static/languages.txt", ProgrammingLanguage) 9 + PATH_TO_FILE = "plugins/mpog_software/public/static/languages.txt"
10 10
11 - list = File.open("plugins/mpog_software/public/static/languages.txt", "r") 11 + SoftwareHelper.create_list_with_file(PATH_TO_FILE, ProgrammingLanguage)
  12 +
  13 + list = File.open(PATH_TO_FILE, "r")
12 count = list.readlines.count 14 count = list.readlines.count
13 list.close 15 list.close
14 16
test/unit/software_info_validation_test.rb
@@ -3,17 +3,27 @@ require File.dirname(__FILE__) + &#39;/../../../../test/test_helper&#39; @@ -3,17 +3,27 @@ require File.dirname(__FILE__) + &#39;/../../../../test/test_helper&#39;
3 class SoftwareInfoValidationTest < ActiveSupport::TestCase 3 class SoftwareInfoValidationTest < ActiveSupport::TestCase
4 4
5 def setup 5 def setup
6 - @community = fast_create(Community, :identifier => 'new-software', :name => 'New Software') 6 + @community = fast_create(
  7 + Community,
  8 + :identifier => 'new-software',
  9 + :name => 'New Software'
  10 + )
7 11
8 @language = ProgrammingLanguage.new(:name => 'C++') 12 @language = ProgrammingLanguage.new(:name => 'C++')
9 @language.save 13 @language.save
10 - @software_language = SoftwareLanguage.new(:version => '1', :operating_system => 'os') 14 + @software_language = SoftwareLanguage.new(
  15 + :version => '1',
  16 + :operating_system => 'os'
  17 + )
11 @software_language.programming_language = @language 18 @software_language.programming_language = @language
12 @software_language.save 19 @software_language.save
13 20
14 @database = DatabaseDescription.new(:name => 'Oracle') 21 @database = DatabaseDescription.new(:name => 'Oracle')
15 @database.save 22 @database.save
16 - @software_database = SoftwareDatabase.new(:version => '2', :operating_system => 'os2') 23 + @software_database = SoftwareDatabase.new(
  24 + :version => '2',
  25 + :operating_system => 'os2'
  26 + )
17 @software_database.database_description = @database 27 @software_database.database_description = @database
18 @software_database.save 28 @software_database.save
19 29
@@ -23,20 +33,23 @@ class SoftwareInfoValidationTest &lt; ActiveSupport::TestCase @@ -23,20 +33,23 @@ class SoftwareInfoValidationTest &lt; ActiveSupport::TestCase
23 @operating_system.operating_system_name = @operating_system_name 33 @operating_system.operating_system_name = @operating_system_name
24 @operating_system.save 34 @operating_system.save
25 35
26 - @software_info = SoftwareInfo.new(:acronym => "SFTW", :e_mag => true,:icp_brasil => true,:intern => true,:e_ping => true,  
27 - :e_arq => true, :operating_platform => true, :objectives => "", :features => "") 36 + @software_info = SoftwareInfo.new(
  37 + :acronym => "SFTW",
  38 + :e_mag => true,
  39 + :icp_brasil => true,
  40 + :intern => true,
  41 + :e_ping => true,
  42 + :e_arq => true,
  43 + :operating_platform => true,
  44 + :objectives => "",
  45 + :features => ""
  46 + )
28 @software_info.software_languages << @software_language 47 @software_info.software_languages << @software_language
29 @software_info.software_databases << @software_database 48 @software_info.software_databases << @software_database
30 @software_info.operating_systems << @operating_system 49 @software_info.operating_systems << @operating_system
31 50
32 @software_info.features = "Do a lot of things" 51 @software_info.features = "Do a lot of things"
33 @software_info.objectives = "All tests should pass !" 52 @software_info.objectives = "All tests should pass !"
34 -  
35 - software_categories = SoftwareCategories::new  
36 - software_categories.administration = true  
37 - software_categories.save  
38 -  
39 - @software_info.software_categories = software_categories  
40 end 53 end
41 54
42 def teardown 55 def teardown
@@ -47,7 +60,6 @@ class SoftwareInfoValidationTest &lt; ActiveSupport::TestCase @@ -47,7 +60,6 @@ class SoftwareInfoValidationTest &lt; ActiveSupport::TestCase
47 OperatingSystem.destroy_all 60 OperatingSystem.destroy_all
48 OperatingSystemName.destroy_all 61 OperatingSystemName.destroy_all
49 SoftwareInfo.destroy_all 62 SoftwareInfo.destroy_all
50 - SoftwareCategories.destroy_all  
51 end 63 end
52 64
53 should 'Save SoftwareInfo if all fields are filled' do 65 should 'Save SoftwareInfo if all fields are filled' do
@@ -94,15 +106,17 @@ class SoftwareInfoValidationTest &lt; ActiveSupport::TestCase @@ -94,15 +106,17 @@ class SoftwareInfoValidationTest &lt; ActiveSupport::TestCase
94 106
95 should "Not save if features are longer than 4000" do 107 should "Not save if features are longer than 4000" do
96 @software_info.features = "a"*4001 108 @software_info.features = "a"*4001
  109 + error_msg = _("Features is too long (maximum is 4000 characters)")
97 110
98 assert_equal false, @software_info.save 111 assert_equal false, @software_info.save
99 - assert_equal true, @software_info.errors.full_messages.include?(_("Features is too long (maximum is 4000 characters)")) 112 + assert_equal true, @software_info.errors.full_messages.include?(error_msg)
100 end 113 end
101 114
102 should "Not save if objectives are longer than 4000" do 115 should "Not save if objectives are longer than 4000" do
103 @software_info.objectives = "a"*4001 116 @software_info.objectives = "a"*4001
  117 + error_msg = _("Objectives is too long (maximum is 4000 characters)")
104 118
105 assert_equal false, @software_info.save 119 assert_equal false, @software_info.save
106 - assert_equal true, @software_info.errors.full_messages.include?(_("Objectives is too long (maximum is 4000 characters)")) 120 + assert_equal true, @software_info.errors.full_messages.include?(error_msg)
107 end 121 end
108 end 122 end
test/unit/software_language_helper_test.rb
@@ -27,12 +27,15 @@ class SoftwareLanguageHelperTest &lt; ActiveSupport::TestCase @@ -27,12 +27,15 @@ class SoftwareLanguageHelperTest &lt; ActiveSupport::TestCase
27 27
28 should "return a list with current software language objects" do 28 should "return a list with current software language objects" do
29 list_compare = [] 29 list_compare = []
30 - assert_equal list_compare.class, SoftwareLanguageHelper.list_language(@software_language_objects).class 30 + softwares = SoftwareLanguageHelper.list_language(@software_language_objects)
  31 + assert_equal list_compare.class, softwares.class
31 end 32 end
32 33
33 should "have same information from the list passed as parameter" do 34 should "have same information from the list passed as parameter" do
34 list_compare = SoftwareLanguageHelper.list_language(@software_language_objects) 35 list_compare = SoftwareLanguageHelper.list_language(@software_language_objects)
35 - assert_equal @software_language_objects.first[:programming_language_id].to_i, list_compare.first.programming_language_id 36 + lang_id = @software_language_objects.first[:programming_language_id].to_i
  37 +
  38 + assert_equal lang_id, list_compare.first.programming_language_id
36 end 39 end
37 40
38 should "return a list with the same size of the parameter" do 41 should "return a list with the same size of the parameter" do
@@ -57,8 +60,8 @@ class SoftwareLanguageHelperTest &lt; ActiveSupport::TestCase @@ -57,8 +60,8 @@ class SoftwareLanguageHelperTest &lt; ActiveSupport::TestCase
57 software_language.programming_language = programming_language 60 software_language.programming_language = programming_language
58 61
59 softwares_languages << software_language 62 softwares_languages << software_language
60 -  
61 - assert_not_nil SoftwareLanguageHelper.language_as_tables(softwares_languages).first.call.index("linux") 63 + lang_table = SoftwareLanguageHelper.language_as_tables(softwares_languages)
  64 + assert_not_nil lang_table.first.call.index("linux")
62 end 65 end
63 66
64 should "remove invalid tables from the list" do 67 should "remove invalid tables from the list" do
test/unit/software_license_info_test.rb
@@ -3,18 +3,26 @@ require File.dirname(__FILE__) + &#39;/../../../../test/test_helper&#39; @@ -3,18 +3,26 @@ require File.dirname(__FILE__) + &#39;/../../../../test/test_helper&#39;
3 class SoftwareDatabaseTest < ActiveSupport::TestCase 3 class SoftwareDatabaseTest < ActiveSupport::TestCase
4 4
5 should "save if all informations are filled" do 5 should "save if all informations are filled" do
6 - @software_license_info = LicenseInfo.create(:version => "GPL", :link => "www.gpl2.com") 6 + @software_license_info = LicenseInfo.create(
  7 + :version => "GPL",
  8 + :link => "www.gpl2.com"
  9 + )
7 assert @software_license_info.save!, "License Info should have been saved" 10 assert @software_license_info.save!, "License Info should have been saved"
8 end 11 end
9 12
10 should "not save if license info version is empty" do 13 should "not save if license info version is empty" do
11 - @software_license_info = LicenseInfo.create(:version => "GPL", :link => "www.gpl2.com") 14 + @software_license_info = LicenseInfo.create(
  15 + :version => "GPL",
  16 + :link => "www.gpl2.com"
  17 + )
12 @software_license_info.version = nil 18 @software_license_info.version = nil
13 assert !@software_license_info.save, "Version can't be blank" 19 assert !@software_license_info.save, "Version can't be blank"
14 end 20 end
15 21
16 should "save if link is empty" do 22 should "save if link is empty" do
17 - @software_license_info = LicenseInfo.create(:version => "GPL", :link => "www.gpl2.com") 23 + @software_license_info = LicenseInfo.create(
  24 + :version => "GPL",
  25 + :link => "www.gpl2.com")
18 @software_license_info.link = nil 26 @software_license_info.link = nil
19 assert @software_license_info.save, "License info should have been saved" 27 assert @software_license_info.save, "License info should have been saved"
20 end 28 end
test/unit/softwares_block_test.rb
@@ -23,7 +23,14 @@ class SoftwaresBlockTest &lt; ActiveSupport::TestCase @@ -23,7 +23,14 @@ class SoftwaresBlockTest &lt; ActiveSupport::TestCase
23 end 23 end
24 24
25 should 'list softwares' do 25 should 'list softwares' do
26 - user = create_person("Jose_Augusto", "jose_augusto@email.com", "aaaaaaa", "aaaaaaa", "jose_silva@email.com", "DF", "Gama") 26 + user = create_person("Jose_Augusto",
  27 + "jose_augusto@email.com",
  28 + "aaaaaaa",
  29 + "aaaaaaa",
  30 + "jose_silva@email.com",
  31 + "DF",
  32 + "Gama"
  33 + )
27 34
28 software_info = create_software_info("new software") 35 software_info = create_software_info("new software")
29 software_info.community.add_member(user) 36 software_info.community.add_member(user)