Commit 4f66c14df550f4eded9d1ba23a2eec41ba19e7b2

Authored by Gabriela Navarro
Committed by David Silva
1 parent 133f6fa9

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 60  
61 61 def community_must_be_approved
62 62 end
63   -
  63 +
64 64 private
65 65  
66 66 def add_software_erros
... ...
test/unit/database_helper_test.rb
... ... @@ -27,12 +27,14 @@ class DatabaseHelperTest &lt; ActiveSupport::TestCase
27 27  
28 28 should "return a list with current database objects" do
29 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 32 end
32 33  
33 34 should "have same information from the list passed as parameter" do
34 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 38 end
37 39  
38 40 should "return a list with the same size of the parameter" do
... ... @@ -57,8 +59,9 @@ class DatabaseHelperTest &lt; ActiveSupport::TestCase
57 59 software_database.database_description = database_description
58 60  
59 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 65 end
63 66  
64 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 21 assert_equal true, @database.save
22 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 25 @database.database_description = nil
26 26 assert_equal true, !@database.save
27 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 30 @database.operating_system = " "
31 31 assert_equal true, !@database.save
32 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 35 @database.version = " "
36 36 assert_equal true, !@database.save
37 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 40 @database.version = "A too long version to be a valid version for database"
41 41 assert !@database.save
42 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 46 assert !@database.save
47 47 end
48 48 end
... ...
test/unit/governmental_power_test.rb
... ... @@ -13,8 +13,20 @@ class GovernmentalPowerTest &lt; ActiveSupport::TestCase
13 13 end
14 14  
15 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 31 assert_equal gov_power.public_institutions.count, PublicInstitution.count
20 32 end
... ...
test/unit/library_helper_test.rb
... ... @@ -5,7 +5,8 @@ class LibraryHelperTest &lt; ActiveSupport::TestCase
5 5 include LibraryHelper
6 6  
7 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 10 {"name" => "license2" ,"version" => "2.1", "license" => "debian", "software_id" => "1"},
10 11 {"name" => "license3" ,"version" => "2.2", "license" => "debian", "software_id" => "1"}]
11 12 end
... ... @@ -21,7 +22,8 @@ class LibraryHelperTest &lt; ActiveSupport::TestCase
21 22  
22 23 should "return a list with current library objects" do
23 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 27 end
26 28  
27 29 should "have same information from the list passed as parameter" do
... ... @@ -46,7 +48,8 @@ class LibraryHelperTest &lt; ActiveSupport::TestCase
46 48 library_description.name = "Lib"
47 49  
48 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 54 end
52 55 end
... ...
test/unit/mpog_person_test.rb
... ... @@ -11,7 +11,9 @@ class MpogSoftwarePluginPersonTest &lt; ActiveSupport::TestCase
11 11 end
12 12  
13 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 17 p.user = fast_create(:user)
16 18  
17 19 assert_equal true, p.save
... ...
test/unit/mpog_software_plugin_test.rb
... ... @@ -6,7 +6,15 @@ class MpogSoftwarePluginTest &lt; ActiveSupport::TestCase
6 6  
7 7 def setup
8 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 18 end
11 19  
12 20 def teardown
... ...
test/unit/software_helper_test.rb
... ... @@ -6,9 +6,11 @@ class SoftwareHelperTest &lt; ActiveSupport::TestCase
6 6  
7 7 should "Create ProgrammingLanguages based on file with languages names" do
8 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 14 count = list.readlines.count
13 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 3 class SoftwareInfoValidationTest < ActiveSupport::TestCase
4 4  
5 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 12 @language = ProgrammingLanguage.new(:name => 'C++')
9 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 18 @software_language.programming_language = @language
12 19 @software_language.save
13 20  
14 21 @database = DatabaseDescription.new(:name => 'Oracle')
15 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 27 @software_database.database_description = @database
18 28 @software_database.save
19 29  
... ... @@ -23,20 +33,23 @@ class SoftwareInfoValidationTest &lt; ActiveSupport::TestCase
23 33 @operating_system.operating_system_name = @operating_system_name
24 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 47 @software_info.software_languages << @software_language
29 48 @software_info.software_databases << @software_database
30 49 @software_info.operating_systems << @operating_system
31 50  
32 51 @software_info.features = "Do a lot of things"
33 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 53 end
41 54  
42 55 def teardown
... ... @@ -47,7 +60,6 @@ class SoftwareInfoValidationTest &lt; ActiveSupport::TestCase
47 60 OperatingSystem.destroy_all
48 61 OperatingSystemName.destroy_all
49 62 SoftwareInfo.destroy_all
50   - SoftwareCategories.destroy_all
51 63 end
52 64  
53 65 should 'Save SoftwareInfo if all fields are filled' do
... ... @@ -94,15 +106,17 @@ class SoftwareInfoValidationTest &lt; ActiveSupport::TestCase
94 106  
95 107 should "Not save if features are longer than 4000" do
96 108 @software_info.features = "a"*4001
  109 + error_msg = _("Features is too long (maximum is 4000 characters)")
97 110  
98 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 113 end
101 114  
102 115 should "Not save if objectives are longer than 4000" do
103 116 @software_info.objectives = "a"*4001
  117 + error_msg = _("Objectives is too long (maximum is 4000 characters)")
104 118  
105 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 121 end
108 122 end
... ...
test/unit/software_language_helper_test.rb
... ... @@ -27,12 +27,15 @@ class SoftwareLanguageHelperTest &lt; ActiveSupport::TestCase
27 27  
28 28 should "return a list with current software language objects" do
29 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 32 end
32 33  
33 34 should "have same information from the list passed as parameter" do
34 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 39 end
37 40  
38 41 should "return a list with the same size of the parameter" do
... ... @@ -57,8 +60,8 @@ class SoftwareLanguageHelperTest &lt; ActiveSupport::TestCase
57 60 software_language.programming_language = programming_language
58 61  
59 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 65 end
63 66  
64 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 3 class SoftwareDatabaseTest < ActiveSupport::TestCase
4 4  
5 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 10 assert @software_license_info.save!, "License Info should have been saved"
8 11 end
9 12  
10 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 18 @software_license_info.version = nil
13 19 assert !@software_license_info.save, "Version can't be blank"
14 20 end
15 21  
16 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 26 @software_license_info.link = nil
19 27 assert @software_license_info.save, "License info should have been saved"
20 28 end
... ...
test/unit/softwares_block_test.rb
... ... @@ -23,7 +23,14 @@ class SoftwaresBlockTest &lt; ActiveSupport::TestCase
23 23 end
24 24  
25 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 35 software_info = create_software_info("new software")
29 36 software_info.community.add_member(user)
... ...