Commit 09c486074433ec51fbf826d832003b94c95e031a

Authored by Luciano Prestes
1 parent 2e95ee26

software-communities: refactoring namespaces

- Test Units

Signed-off-by: Luciano Prestes Cavalcanti <lucianopcbr@gmail.com>
Showing 24 changed files with 135 additions and 135 deletions   Show diff stats
src/noosfero-spb/software_communities/test/unit/categories_and_tags_block_test.rb
1 require File.dirname(__FILE__) + '/../../../../test/test_helper' 1 require File.dirname(__FILE__) + '/../../../../test/test_helper'
2 require File.dirname(__FILE__) + '/../helpers/plugin_test_helper' 2 require File.dirname(__FILE__) + '/../helpers/plugin_test_helper'
3 3
4 -class CategoriesAndTagsBlockTest < ActiveSupport::TestCase 4 +class SoftwareCommunitiesPlugin::CategoriesAndTagsBlockTest < ActiveSupport::TestCase
5 include PluginTestHelper 5 include PluginTestHelper
6 should 'inherit from Block' do 6 should 'inherit from Block' do
7 - assert_kind_of Block, CategoriesAndTagsBlock.new 7 + assert_kind_of Block, SoftwareCommunitiesPlugin::CategoriesAndTagsBlock.new
8 end 8 end
9 9
10 should 'declare its default title' do 10 should 'declare its default title' do
11 - CategoriesAndTagsBlock.any_instance.stubs(:profile_count).returns(0)  
12 - assert_equal Block.new.default_title, CategoriesAndTagsBlock.new.default_title 11 + SoftwareCommunitiesPlugin::CategoriesAndTagsBlock.any_instance.stubs(:profile_count).returns(0)
  12 + assert_equal Block.new.default_title, SoftwareCommunitiesPlugin::CategoriesAndTagsBlock.new.default_title
13 end 13 end
14 14
15 should 'describe itself' do 15 should 'describe itself' do
16 - assert_not_equal Block.description, CategoriesAndTagsBlock.description 16 + assert_not_equal Block.description, SoftwareCommunitiesPlugin::CategoriesAndTagsBlock.description
17 end 17 end
18 18
19 end 19 end
src/noosfero-spb/software_communities/test/unit/categories_software_block_test.rb
@@ -4,16 +4,16 @@ require File.dirname(__FILE__) + &#39;/../helpers/plugin_test_helper&#39; @@ -4,16 +4,16 @@ require File.dirname(__FILE__) + &#39;/../helpers/plugin_test_helper&#39;
4 class CategoriesSoftwareBlockTest < ActiveSupport::TestCase 4 class CategoriesSoftwareBlockTest < ActiveSupport::TestCase
5 include PluginTestHelper 5 include PluginTestHelper
6 should 'inherit from Block' do 6 should 'inherit from Block' do
7 - assert_kind_of Block, CategoriesSoftwareBlock.new 7 + assert_kind_of Block, SoftwareCommunitiesPlugin::CategoriesSoftwareBlock.new
8 end 8 end
9 9
10 should 'declare its default title' do 10 should 'declare its default title' do
11 - CategoriesSoftwareBlock.any_instance.stubs(:profile_count).returns(0)  
12 - assert_equal Block.new.default_title, CategoriesSoftwareBlock.new.default_title 11 + SoftwareCommunitiesPlugin::CategoriesSoftwareBlock.any_instance.stubs(:profile_count).returns(0)
  12 + assert_equal Block.new.default_title, SoftwareCommunitiesPlugin::CategoriesSoftwareBlock.new.default_title
13 end 13 end
14 14
15 should 'describe itself' do 15 should 'describe itself' do
16 - assert_not_equal Block.description, CategoriesSoftwareBlock.description 16 + assert_not_equal Block.description, SoftwareCommunitiesPlugin::CategoriesSoftwareBlock.description
17 end 17 end
18 18
19 end 19 end
src/noosfero-spb/software_communities/test/unit/communities_block_test.rb
@@ -13,12 +13,12 @@ class CommunitiesBlockTest &lt; ActiveSupport::TestCase @@ -13,12 +13,12 @@ class CommunitiesBlockTest &lt; ActiveSupport::TestCase
13 @community.add_member(@person) 13 @community.add_member(@person)
14 14
15 15
16 - @comminities_block = CommunitiesBlock.new 16 + @comminities_block = SoftwareCommunitiesPlugin::CommunitiesBlock.new
17 @comminities_block.expects(:owner).at_least_once.returns(@person) 17 @comminities_block.expects(:owner).at_least_once.returns(@person)
18 end 18 end
19 19
20 def teardown 20 def teardown
21 - CommunitiesBlock.destroy_all 21 + SoftwareCommunitiesPlugin::CommunitiesBlock.destroy_all
22 @person = nil 22 @person = nil
23 @community = nil 23 @community = nil
24 @software_info = nil 24 @software_info = nil
src/noosfero-spb/software_communities/test/unit/create_software_test.rb
@@ -7,11 +7,11 @@ class CreateSoftwareTest &lt; ActiveSupport::TestCase @@ -7,11 +7,11 @@ class CreateSoftwareTest &lt; ActiveSupport::TestCase
7 end 7 end
8 8
9 should 'be a task' do 9 should 'be a task' do
10 - ok { CreateSoftware.new.kind_of?(Task) } 10 + ok { SoftwareCommunitiesPlugin::CreateSoftware.new.kind_of?(Task) }
11 end 11 end
12 12
13 should 'require a requestor' do 13 should 'require a requestor' do
14 - task = CreateSoftware.new(:name => 'Software Test', :target => Environment.default) 14 + task = SoftwareCommunitiesPlugin::CreateSoftware.new(:name => 'Software Test', :target => Environment.default)
15 task.valid? 15 task.valid?
16 16
17 assert task.errors[:requestor_id.to_s].present? 17 assert task.errors[:requestor_id.to_s].present?
@@ -24,7 +24,7 @@ class CreateSoftwareTest &lt; ActiveSupport::TestCase @@ -24,7 +24,7 @@ class CreateSoftwareTest &lt; ActiveSupport::TestCase
24 end 24 end
25 25
26 should 'actually create new software community when confirmed' do 26 should 'actually create new software community when confirmed' do
27 - task = CreateSoftware.create!(:name => 'Software Test', :target => Environment.default, :requestor => @requestor, :finality => "Any") 27 + task = SoftwareCommunitiesPlugin::CreateSoftware.create!(:name => 'Software Test', :target => Environment.default, :requestor => @requestor, :finality => "Any")
28 28
29 assert_difference 'SoftwareInfo.count' do 29 assert_difference 'SoftwareInfo.count' do
30 assert_difference 'Community.count' do 30 assert_difference 'Community.count' do
@@ -36,7 +36,7 @@ class CreateSoftwareTest &lt; ActiveSupport::TestCase @@ -36,7 +36,7 @@ class CreateSoftwareTest &lt; ActiveSupport::TestCase
36 end 36 end
37 37
38 should 'create new software community with all informed data when confirmed' do 38 should 'create new software community with all informed data when confirmed' do
39 - task = CreateSoftware.create!(:name => 'Software Test', :target => Environment.default, :requestor => @requestor, :finality => "Any", :repository_link => "#", ) 39 + task = SoftwareCommunitiesPlugin::CreateSoftware.create!(:name => 'Software Test', :target => Environment.default, :requestor => @requestor, :finality => "Any", :repository_link => "#", )
40 40
41 task.finish 41 task.finish
42 software = Community["software-test"].software_info 42 software = Community["software-test"].software_info
@@ -47,7 +47,7 @@ class CreateSoftwareTest &lt; ActiveSupport::TestCase @@ -47,7 +47,7 @@ class CreateSoftwareTest &lt; ActiveSupport::TestCase
47 end 47 end
48 48
49 should 'override message methods from Task' do 49 should 'override message methods from Task' do
50 - task = CreateSoftware.create!(:name => 'Software Test', :target => Environment.default, :requestor => @requestor, :finality => "Any") 50 + task = SoftwareCommunitiesPlugin::CreateSoftware.create!(:name => 'Software Test', :target => Environment.default, :requestor => @requestor, :finality => "Any")
51 51
52 task.finish 52 task.finish
53 53
@@ -59,13 +59,13 @@ class CreateSoftwareTest &lt; ActiveSupport::TestCase @@ -59,13 +59,13 @@ class CreateSoftwareTest &lt; ActiveSupport::TestCase
59 end 59 end
60 60
61 should 'report as approved when approved' do 61 should 'report as approved when approved' do
62 - request = CreateSoftware.new 62 + request = SoftwareCommunitiesPlugin::CreateSoftware.new
63 request.stubs(:status).returns(Task::Status::FINISHED) 63 request.stubs(:status).returns(Task::Status::FINISHED)
64 assert request.approved? 64 assert request.approved?
65 end 65 end
66 66
67 should 'report as rejected when rejected' do 67 should 'report as rejected when rejected' do
68 - request = CreateSoftware.new 68 + request = SoftwareCommunitiesPlugin::CreateSoftware.new
69 request.stubs(:status).returns(Task::Status::CANCELLED) 69 request.stubs(:status).returns(Task::Status::CANCELLED)
70 assert request.rejected? 70 assert request.rejected?
71 end 71 end
src/noosfero-spb/software_communities/test/unit/database_helper_test.rb
@@ -3,8 +3,8 @@ require File.dirname(__FILE__) + &#39;/../../../../test/test_helper&#39; @@ -3,8 +3,8 @@ require File.dirname(__FILE__) + &#39;/../../../../test/test_helper&#39;
3 class DatabaseHelperTest < ActiveSupport::TestCase 3 class DatabaseHelperTest < ActiveSupport::TestCase
4 4
5 def setup 5 def setup
6 - dd1 = DatabaseDescription.create(:name => "Oracle")  
7 - dd2 = DatabaseDescription.create!(:name => "MySQL") 6 + dd1 = SoftwareCommunitiesPlugin::DatabaseDescription.create(:name => "Oracle")
  7 + dd2 = SoftwareCommunitiesPlugin::DatabaseDescription.create!(:name => "MySQL")
8 8
9 @database_objects = [ 9 @database_objects = [
10 {:database_description_id => dd1.id.to_s ,:version => "2.0"}, 10 {:database_description_id => dd1.id.to_s ,:version => "2.0"},
@@ -14,35 +14,35 @@ class DatabaseHelperTest &lt; ActiveSupport::TestCase @@ -14,35 +14,35 @@ class DatabaseHelperTest &lt; ActiveSupport::TestCase
14 14
15 def teardown 15 def teardown
16 @database_objects = nil 16 @database_objects = nil
17 - SoftwareDatabase.destroy_all  
18 - DatabaseDescription.destroy_all 17 + SoftwareCommunitiesPlugin::SoftwareDatabase.destroy_all
  18 + SoftwareCommunitiesPlugin::DatabaseDescription.destroy_all
19 end 19 end
20 20
21 should "return an empty list" do 21 should "return an empty list" do
22 empty_list = [] 22 empty_list = []
23 - assert_equal [], DatabaseHelper.list_database(empty_list) 23 + assert_equal [], SoftwareCommunitiesPlugin::DatabaseHelper.list_database(empty_list)
24 end 24 end
25 25
26 should "return a list with current database objects" do 26 should "return a list with current database objects" do
27 list_compare = [] 27 list_compare = []
28 - db_tables = DatabaseHelper.list_database(@database_objects) 28 + db_tables = SoftwareCommunitiesPlugin::DatabaseHelper.list_database(@database_objects)
29 assert_equal list_compare.class, db_tables.class 29 assert_equal list_compare.class, db_tables.class
30 end 30 end
31 31
32 should "have same information from the list passed as parameter" do 32 should "have same information from the list passed as parameter" do
33 - list_compare = DatabaseHelper.list_database(@database_objects) 33 + list_compare = SoftwareCommunitiesPlugin::DatabaseHelper.list_database(@database_objects)
34 db_objects_id = @database_objects.first[:database_description_id] 34 db_objects_id = @database_objects.first[:database_description_id]
35 assert_equal db_objects_id.to_i, list_compare.first.database_description_id 35 assert_equal db_objects_id.to_i, list_compare.first.database_description_id
36 end 36 end
37 37
38 should "return a list with the same size of the parameter" do 38 should "return a list with the same size of the parameter" do
39 - list_compare = DatabaseHelper.list_database(@database_objects) 39 + list_compare = SoftwareCommunitiesPlugin::DatabaseHelper.list_database(@database_objects)
40 assert_equal @database_objects.count, list_compare.count 40 assert_equal @database_objects.count, list_compare.count
41 end 41 end
42 42
43 should "return false if list_database are empty or null" do 43 should "return false if list_database are empty or null" do
44 list_compare = [] 44 list_compare = []
45 - assert_equal false,DatabaseHelper.valid_list_database?(list_compare) 45 + assert_equal false, SoftwareCommunitiesPlugin::DatabaseHelper.valid_list_database?(list_compare)
46 end 46 end
47 47
48 should "remove invalid tables from the list" do 48 should "remove invalid tables from the list" do
@@ -52,7 +52,7 @@ class DatabaseHelperTest &lt; ActiveSupport::TestCase @@ -52,7 +52,7 @@ class DatabaseHelperTest &lt; ActiveSupport::TestCase
52 }) 52 })
53 53
54 database_objects_length = @database_objects.count 54 database_objects_length = @database_objects.count
55 - list_compare = DatabaseHelper.list_database(@database_objects) 55 + list_compare = SoftwareCommunitiesPlugin::DatabaseHelper.list_database(@database_objects)
56 assert_equal list_compare.count, database_objects_length-1 56 assert_equal list_compare.count, database_objects_length-1
57 end 57 end
58 end 58 end
src/noosfero-spb/software_communities/test/unit/database_validation_test.rb
@@ -3,8 +3,8 @@ require File.dirname(__FILE__) + &#39;/../../../../test/test_helper&#39; @@ -3,8 +3,8 @@ require File.dirname(__FILE__) + &#39;/../../../../test/test_helper&#39;
3 class DatabaseValidationTest < ActiveSupport::TestCase 3 class DatabaseValidationTest < ActiveSupport::TestCase
4 4
5 def setup 5 def setup
6 - @database_desc = DatabaseDescription.create(:name => "ABC")  
7 - @database = SoftwareDatabase.new 6 + @database_desc = SoftwareCommunitiesPlugin::DatabaseDescription.create(:name => "ABC")
  7 + @database = SoftwareCommunitiesPlugin::SoftwareDatabase.new
8 @database.database_description = @database_desc 8 @database.database_description = @database_desc
9 @database.version = "MYSQL" 9 @database.version = "MYSQL"
10 @database 10 @database
@@ -12,8 +12,8 @@ class DatabaseValidationTest &lt; ActiveSupport::TestCase @@ -12,8 +12,8 @@ class DatabaseValidationTest &lt; ActiveSupport::TestCase
12 12
13 def teardown 13 def teardown
14 @database = nil 14 @database = nil
15 - DatabaseDescription.destroy_all  
16 - SoftwareDatabase.destroy_all 15 + SoftwareCommunitiesPlugin::DatabaseDescription.destroy_all
  16 + SoftwareCommunitiesPlugin::SoftwareDatabase.destroy_all
17 end 17 end
18 18
19 should "Save database if all fields are filled" do 19 should "Save database if all fields are filled" do
src/noosfero-spb/software_communities/test/unit/download_block_test.rb
@@ -4,16 +4,16 @@ require File.dirname(__FILE__) + &#39;/../helpers/plugin_test_helper&#39; @@ -4,16 +4,16 @@ require File.dirname(__FILE__) + &#39;/../helpers/plugin_test_helper&#39;
4 class DownloadBlockTest < ActiveSupport::TestCase 4 class DownloadBlockTest < ActiveSupport::TestCase
5 include PluginTestHelper 5 include PluginTestHelper
6 should 'inherit from Block' do 6 should 'inherit from Block' do
7 - assert_kind_of Block, DownloadBlock.new 7 + assert_kind_of Block, SoftwareCommunitiesPlugin::DownloadBlock.new
8 end 8 end
9 9
10 should 'declare its default title' do 10 should 'declare its default title' do
11 - DownloadBlock.any_instance.stubs(:profile_count).returns(0)  
12 - assert_equal Block.new.default_title, DownloadBlock.new.default_title 11 + SoftwareCommunitiesPlugin::DownloadBlock.any_instance.stubs(:profile_count).returns(0)
  12 + assert_equal Block.new.default_title, SoftwareCommunitiesPlugin::DownloadBlock.new.default_title
13 end 13 end
14 14
15 should 'describe itself' do 15 should 'describe itself' do
16 - assert_not_equal Block.description, DownloadBlock.description 16 + assert_not_equal Block.description, SoftwareCommunitiesPlugin::DownloadBlock.description
17 end 17 end
18 18
19 should 'have software info to download it' do 19 should 'have software info to download it' do
@@ -24,7 +24,7 @@ class DownloadBlockTest &lt; ActiveSupport::TestCase @@ -24,7 +24,7 @@ class DownloadBlockTest &lt; ActiveSupport::TestCase
24 link2 = "gitlab.com/teste/2" 24 link2 = "gitlab.com/teste/2"
25 name2 = "Test Software2" 25 name2 = "Test Software2"
26 26
27 - block = DownloadBlock.create(:downloads => [{:name => name1, :link => link1}, {:name => name2, :link => link2}]) 27 + block = SoftwareCommunitiesPlugin::DownloadBlock.create(:downloads => [{:name => name1, :link => link1}, {:name => name2, :link => link2}])
28 28
29 assert_equal block.downloads[0][:link], link1, "Link should not be empty" 29 assert_equal block.downloads[0][:link], link1, "Link should not be empty"
30 assert_equal block.downloads[0][:name], name1, "Name should not be empty" 30 assert_equal block.downloads[0][:name], name1, "Name should not be empty"
src/noosfero-spb/software_communities/test/unit/download_test.rb
@@ -26,8 +26,8 @@ class DownloadTest &lt; ActiveSupport::TestCase @@ -26,8 +26,8 @@ class DownloadTest &lt; ActiveSupport::TestCase
26 end 26 end
27 27
28 should "Set as 0(zero) total_downloads if it is not given" do 28 should "Set as 0(zero) total_downloads if it is not given" do
29 - without_total_downloads = Download.new({})  
30 - with_total_downloads = Download.new(@downloads_sample_data.last) 29 + without_total_downloads = SoftwareCommunitiesPlugin::Download.new({})
  30 + with_total_downloads = SoftwareCommunitiesPlugin::Download.new(@downloads_sample_data.last)
31 31
32 assert_equal 0, without_total_downloads.total_downloads 32 assert_equal 0, without_total_downloads.total_downloads
33 assert_equal @downloads_sample_data.last[:total_downloads], with_total_downloads.total_downloads 33 assert_equal @downloads_sample_data.last[:total_downloads], with_total_downloads.total_downloads
@@ -35,14 +35,14 @@ class DownloadTest &lt; ActiveSupport::TestCase @@ -35,14 +35,14 @@ class DownloadTest &lt; ActiveSupport::TestCase
35 35
36 should "Remove downloads without a name" do 36 should "Remove downloads without a name" do
37 @downloads_sample_data[1] = @downloads_sample_data[1].slice! :name 37 @downloads_sample_data[1] = @downloads_sample_data[1].slice! :name
38 - downloads = Download.validate_download_list @downloads_sample_data 38 + downloads = SoftwareCommunitiesPlugin::Download.validate_download_list @downloads_sample_data
39 39
40 assert_equal 1, downloads.size 40 assert_equal 1, downloads.size
41 assert_equal @downloads_sample_data[0][:name], downloads[0][:name] 41 assert_equal @downloads_sample_data[0][:name], downloads[0][:name]
42 end 42 end
43 43
44 should "Only set total_downloads if the value is integer" do 44 should "Only set total_downloads if the value is integer" do
45 - download = Download.new(@downloads_sample_data.last) 45 + download = SoftwareCommunitiesPlugin::Download.new(@downloads_sample_data.last)
46 46
47 download.total_downloads = "456" 47 download.total_downloads = "456"
48 assert_not_equal 456, download.total_downloads 48 assert_not_equal 456, download.total_downloads
src/noosfero-spb/software_communities/test/unit/library_helper_test.rb
@@ -15,38 +15,38 @@ class LibraryHelperTest &lt; ActiveSupport::TestCase @@ -15,38 +15,38 @@ class LibraryHelperTest &lt; ActiveSupport::TestCase
15 15
16 should "return an empty list" do 16 should "return an empty list" do
17 empty_list = [] 17 empty_list = []
18 - assert_equal [],LibraryHelper.list_library(empty_list) 18 + assert_equal [], SoftwareCommunitiesPlugin::LibraryHelper.list_library(empty_list)
19 end 19 end
20 20
21 should "return a list with current library objects" do 21 should "return a list with current library objects" do
22 list_compare = [] 22 list_compare = []
23 - lib_table = LibraryHelper.list_library(@license_objects) 23 + lib_table = SoftwareCommunitiesPlugin::LibraryHelper.list_library(@license_objects)
24 assert_equal list_compare.class, lib_table.class 24 assert_equal list_compare.class, lib_table.class
25 end 25 end
26 26
27 should "have same information from the list passed as parameter" do 27 should "have same information from the list passed as parameter" do
28 - list_compare = LibraryHelper.list_library(@license_objects) 28 + list_compare = SoftwareCommunitiesPlugin::LibraryHelper.list_library(@license_objects)
29 assert_equal @license_objects.first[:name], list_compare.first.name 29 assert_equal @license_objects.first[:name], list_compare.first.name
30 end 30 end
31 31
32 should "return a list with the same size of the parameter" do 32 should "return a list with the same size of the parameter" do
33 - list_compare = LibraryHelper.list_library(@license_objects) 33 + list_compare = SoftwareCommunitiesPlugin::LibraryHelper.list_library(@license_objects)
34 assert_equal @license_objects.count, list_compare.count 34 assert_equal @license_objects.count, list_compare.count
35 end 35 end
36 36
37 should "return false if list_database are empty or null" do 37 should "return false if list_database are empty or null" do
38 list_compare = [] 38 list_compare = []
39 - assert_equal true, LibraryHelper.valid_list_library?(list_compare) 39 + assert_equal true, SoftwareCommunitiesPlugin::LibraryHelper.valid_list_library?(list_compare)
40 end 40 end
41 41
42 should "return a html text with license name equals to linux" do 42 should "return a html text with license name equals to linux" do
43 libraries = [] 43 libraries = []
44 44
45 - library_description = Library.new 45 + library_description = SoftwareCommunitiesPlugin::Library.new
46 library_description.name = "Lib" 46 library_description.name = "Lib"
47 47
48 libraries << library_description 48 libraries << library_description
49 - lib_table = LibraryHelper.libraries_as_tables(libraries) 49 + lib_table = SoftwareCommunitiesPlugin::LibraryHelper.libraries_as_tables(libraries)
50 50
51 assert_not_nil lib_table.first.call.index("lib") 51 assert_not_nil lib_table.first.call.index("lib")
52 end 52 end
src/noosfero-spb/software_communities/test/unit/library_validation_test.rb
@@ -3,7 +3,7 @@ require File.dirname(__FILE__) + &#39;/../../../../test/test_helper&#39; @@ -3,7 +3,7 @@ require File.dirname(__FILE__) + &#39;/../../../../test/test_helper&#39;
3 class LibraryValidationTest < ActiveSupport::TestCase 3 class LibraryValidationTest < ActiveSupport::TestCase
4 4
5 def setup 5 def setup
6 - @library = Library.new 6 + @library = SoftwareCommunitiesPlugin::Library.new
7 @library.name = "name" 7 @library.name = "name"
8 @library.version = "version" 8 @library.version = "version"
9 @library.license = "license" 9 @library.license = "license"
src/noosfero-spb/software_communities/test/unit/operating_system_helper_test.rb
@@ -21,44 +21,44 @@ class OperatingSystemHelperTest &lt; ActiveSupport::TestCase @@ -21,44 +21,44 @@ class OperatingSystemHelperTest &lt; ActiveSupport::TestCase
21 21
22 should "return an empty list" do 22 should "return an empty list" do
23 empty_list = [] 23 empty_list = []
24 - assert_equal [],OperatingSystemHelper.list_operating_system(empty_list) 24 + assert_equal [], SoftwareCommunitiesPlugin::OperatingSystemHelper.list_operating_system(empty_list)
25 end 25 end
26 26
27 should "return a list with current OperatingSystems" do 27 should "return a list with current OperatingSystems" do
28 list_compare = [] 28 list_compare = []
29 - list_op = OperatingSystemHelper.list_operating_system(@operating_system_objects) 29 + list_op = SoftwareCommunitiesPlugin::OperatingSystemHelper.list_operating_system(@operating_system_objects)
30 assert_equal list_compare.class, list_op.class 30 assert_equal list_compare.class, list_op.class
31 end 31 end
32 32
33 should "have same information from the list passed as parameter" do 33 should "have same information from the list passed as parameter" do
34 - list_compare = OperatingSystemHelper.list_operating_system(@operating_system_objects) 34 + list_compare = SoftwareCommunitiesPlugin::OperatingSystemHelper.list_operating_system(@operating_system_objects)
35 first_operating = @operating_system_objects.first[:operating_system_name_id] 35 first_operating = @operating_system_objects.first[:operating_system_name_id]
36 assert_equal first_operating, list_compare.first.operating_system_name_id.to_s 36 assert_equal first_operating, list_compare.first.operating_system_name_id.to_s
37 end 37 end
38 38
39 should "return a list with the same size of the parameter" do 39 should "return a list with the same size of the parameter" do
40 - list_compare = OperatingSystemHelper.list_operating_system(@operating_system_objects) 40 + list_compare = SoftwareCommunitiesPlugin::OperatingSystemHelper.list_operating_system(@operating_system_objects)
41 assert_equal @operating_system_objects.count, list_compare.count 41 assert_equal @operating_system_objects.count, list_compare.count
42 end 42 end
43 43
44 should "return false if list_operating_system are empty or null" do 44 should "return false if list_operating_system are empty or null" do
45 list_compare = [] 45 list_compare = []
46 - assert_equal false,OperatingSystemHelper.valid_list_operating_system?(list_compare) 46 + assert_equal false, SoftwareCommunitiesPlugin::OperatingSystemHelper.valid_list_operating_system?(list_compare)
47 end 47 end
48 48
49 should "return a html text with operating system" do 49 should "return a html text with operating system" do
50 operating_systems = [] 50 operating_systems = []
51 51
52 - operating_system = OperatingSystemName.new 52 + operating_system = SoftwareCommunitiesPlugin::OperatingSystemName.new
53 operating_system.name = "teste" 53 operating_system.name = "teste"
54 54
55 - software_operating_system = OperatingSystem.new 55 + software_operating_system = SoftwareCommunitiesPlugin::OperatingSystem.new
56 software_operating_system.version = 2 56 software_operating_system.version = 2
57 software_operating_system.operating_system_name = operating_system 57 software_operating_system.operating_system_name = operating_system
58 58
59 operating_systems << software_operating_system 59 operating_systems << software_operating_system
60 - op_table = OperatingSystemHelper.operating_system_as_tables(operating_systems) 60 + op_table = SoftwareCommunitiesPlugin::OperatingSystemHelper.operating_system_as_tables(operating_systems)
61 61
62 - assert_not_nil op_table.first.call.index(OperatingSystemName.first.name) 62 + assert_not_nil op_table.first.call.index(SoftwareCommunitiesPlugin::OperatingSystemName.first.name)
63 end 63 end
64 end 64 end
src/noosfero-spb/software_communities/test/unit/operating_system_validation_test.rb
@@ -3,8 +3,8 @@ require File.dirname(__FILE__) + &#39;/../../../../test/test_helper&#39; @@ -3,8 +3,8 @@ require File.dirname(__FILE__) + &#39;/../../../../test/test_helper&#39;
3 class OperatingSystemValidationTest < ActiveSupport::TestCase 3 class OperatingSystemValidationTest < ActiveSupport::TestCase
4 4
5 def setup 5 def setup
6 - operating_system_name = OperatingSystemName::new :name=>"Linux"  
7 - @operating_system = OperatingSystem::new :version=>"3.0" 6 + operating_system_name = SoftwareCommunitiesPlugin::OperatingSystemName::new :name=>"Linux"
  7 + @operating_system = SoftwareCommunitiesPlugin::OperatingSystem::new :version=>"3.0"
8 @operating_system.operating_system_name = operating_system_name 8 @operating_system.operating_system_name = operating_system_name
9 @operating_system 9 @operating_system
10 end 10 end
src/noosfero-spb/software_communities/test/unit/repository_block_test.rb
@@ -5,15 +5,15 @@ class RepositoryBlockTest &lt; ActiveSupport::TestCase @@ -5,15 +5,15 @@ class RepositoryBlockTest &lt; ActiveSupport::TestCase
5 include PluginTestHelper 5 include PluginTestHelper
6 6
7 should 'inherit from Block' do 7 should 'inherit from Block' do
8 - assert_kind_of Block, RepositoryBlock.new 8 + assert_kind_of Block, SoftwareCommunitiesPlugin::RepositoryBlock.new
9 end 9 end
10 10
11 should 'declare its default title' do 11 should 'declare its default title' do
12 - RepositoryBlock.any_instance.stubs(:profile_count).returns(0)  
13 - assert_equal Block.new.default_title, RepositoryBlock.new.default_title 12 + SoftwareCommunitiesPlugin::RepositoryBlock.any_instance.stubs(:profile_count).returns(0)
  13 + assert_equal Block.new.default_title, SoftwareCommunitiesPlugin::RepositoryBlock.new.default_title
14 end 14 end
15 15
16 should 'describe itself' do 16 should 'describe itself' do
17 - assert_not_equal Block.description, RepositoryBlock.description 17 + assert_not_equal Block.description, SoftwareCommunitiesPlugin::RepositoryBlock.description
18 end 18 end
19 end 19 end
src/noosfero-spb/software_communities/test/unit/search_catalog_block_test.rb
@@ -4,16 +4,16 @@ require File.dirname(__FILE__) + &#39;/../helpers/plugin_test_helper&#39; @@ -4,16 +4,16 @@ require File.dirname(__FILE__) + &#39;/../helpers/plugin_test_helper&#39;
4 class SearchCatalogBlockTest < ActiveSupport::TestCase 4 class SearchCatalogBlockTest < ActiveSupport::TestCase
5 include PluginTestHelper 5 include PluginTestHelper
6 should 'inherit from Block' do 6 should 'inherit from Block' do
7 - assert_kind_of Block, SearchCatalogBlock.new 7 + assert_kind_of Block, SoftwareCommunitiesPlugin::SearchCatalogBlock.new
8 end 8 end
9 9
10 should 'declare its default title' do 10 should 'declare its default title' do
11 - SearchCatalogBlock.any_instance.stubs(:profile_count).returns(0)  
12 - assert_equal Block.new.default_title, SearchCatalogBlock.new.default_title 11 + SoftwareCommunitiesPlugin::SearchCatalogBlock.any_instance.stubs(:profile_count).returns(0)
  12 + assert_equal Block.new.default_title, SoftwareCommunitiesPlugin::SearchCatalogBlock.new.default_title
13 end 13 end
14 14
15 should 'describe itself' do 15 should 'describe itself' do
16 - assert_not_equal Block.description, SearchCatalogBlock.description 16 + assert_not_equal Block.description, SoftwareCommunitiesPlugin::SearchCatalogBlock.description
17 end 17 end
18 18
19 end 19 end
src/noosfero-spb/software_communities/test/unit/software_database_test.rb
@@ -2,16 +2,16 @@ require File.dirname(__FILE__) + &#39;/../../../../test/test_helper&#39; @@ -2,16 +2,16 @@ require File.dirname(__FILE__) + &#39;/../../../../test/test_helper&#39;
2 2
3 class SoftwareDatabaseTest < ActiveSupport::TestCase 3 class SoftwareDatabaseTest < ActiveSupport::TestCase
4 def setup 4 def setup
5 - DatabaseDescription.create!(name: "PostgreSQL")  
6 - @software_database = SoftwareDatabase.new( 5 + SoftwareCommunitiesPlugin::DatabaseDescription.create!(name: "PostgreSQL")
  6 + @software_database = SoftwareCommunitiesPlugin::SoftwareDatabase.new(
7 :version => "1.0" 7 :version => "1.0"
8 ) 8 )
9 @software_database.database_description_id = 1 9 @software_database.database_description_id = 1
10 end 10 end
11 11
12 def teardown 12 def teardown
13 - DatabaseDescription.destroy_all  
14 - SoftwareDatabase.destroy_all 13 + SoftwareCommunitiesPlugin::DatabaseDescription.destroy_all
  14 + SoftwareCommunitiesPlugin::SoftwareDatabase.destroy_all
15 end 15 end
16 16
17 should "save if all informations of @software_database are filled" do 17 should "save if all informations of @software_database are filled" do
src/noosfero-spb/software_communities/test/unit/software_helper_test.rb
@@ -2,19 +2,19 @@ require File.dirname(__FILE__) + &#39;/../../../../test/test_helper&#39; @@ -2,19 +2,19 @@ require File.dirname(__FILE__) + &#39;/../../../../test/test_helper&#39;
2 2
3 class SoftwareHelperTest < ActiveSupport::TestCase 3 class SoftwareHelperTest < ActiveSupport::TestCase
4 4
5 - include SoftwareHelper 5 + include SoftwareCommunitiesPlugin::SoftwareHelper
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 + SoftwareCommunitiesPlugin::ProgrammingLanguage.delete_all
9 PATH_TO_FILE = "plugins/software_communities/public/static/languages.txt" 9 PATH_TO_FILE = "plugins/software_communities/public/static/languages.txt"
10 10
11 - SoftwareHelper.create_list_with_file(PATH_TO_FILE, ProgrammingLanguage) 11 + SoftwareCommunitiesPlugin::SoftwareHelper.create_list_with_file(PATH_TO_FILE, SoftwareCommunitiesPlugin::ProgrammingLanguage)
12 12
13 list = File.open(PATH_TO_FILE, "r") 13 list = File.open(PATH_TO_FILE, "r")
14 count = list.readlines.count 14 count = list.readlines.count
15 list.close 15 list.close
16 16
17 - assert(ProgrammingLanguage.count == count) 17 + assert(SoftwareCommunitiesPlugin::ProgrammingLanguage.count == count)
18 end 18 end
19 19
20 should "return the software template specified in config.yml file" do 20 should "return the software template specified in config.yml file" do
@@ -22,9 +22,9 @@ class SoftwareHelperTest &lt; ActiveSupport::TestCase @@ -22,9 +22,9 @@ class SoftwareHelperTest &lt; ActiveSupport::TestCase
22 22
23 parsed_yaml = {"software_template" => "software_template"} 23 parsed_yaml = {"software_template" => "software_template"}
24 24
25 - SoftwareHelper.stubs(:software_template_identifier).returns("software_template") 25 + SoftwareCommunitiesPlugin::SoftwareHelper.stubs(:software_template_identifier).returns("software_template")
26 26
27 - software_template = SoftwareHelper.software_template 27 + software_template = SoftwareCommunitiesPlugin::SoftwareHelper.software_template
28 assert !software_template.blank? 28 assert !software_template.blank?
29 assert software_template.is_template 29 assert software_template.is_template
30 end 30 end
@@ -32,14 +32,14 @@ class SoftwareHelperTest &lt; ActiveSupport::TestCase @@ -32,14 +32,14 @@ class SoftwareHelperTest &lt; ActiveSupport::TestCase
32 should "not return the software template if there is not software template" do 32 should "not return the software template if there is not software template" do
33 parsed_yaml = {"software_template" => "software_template"} 33 parsed_yaml = {"software_template" => "software_template"}
34 34
35 - SoftwareHelper.stubs(:software_template_identifier).returns("software_template") 35 + SoftwareCommunitiesPlugin::SoftwareHelper.stubs(:software_template_identifier).returns("software_template")
36 36
37 - software_template = SoftwareHelper.software_template 37 + software_template = SoftwareCommunitiesPlugin::SoftwareHelper.software_template
38 assert software_template.blank? 38 assert software_template.blank?
39 39
40 template_community = Community.create!(:name => "Software", :identifier => "software_template") 40 template_community = Community.create!(:name => "Software", :identifier => "software_template")
41 41
42 - software_template = SoftwareHelper.software_template 42 + software_template = SoftwareCommunitiesPlugin::SoftwareHelper.software_template
43 assert software_template.blank? 43 assert software_template.blank?
44 end 44 end
45 end 45 end
src/noosfero-spb/software_communities/test/unit/software_info_test.rb
@@ -3,7 +3,7 @@ require File.dirname(__FILE__) + &#39;/../helpers/plugin_test_helper&#39; @@ -3,7 +3,7 @@ require File.dirname(__FILE__) + &#39;/../helpers/plugin_test_helper&#39;
3 3
4 class SoftwareInfoValidationTest < ActiveSupport::TestCase 4 class SoftwareInfoValidationTest < ActiveSupport::TestCase
5 5
6 - include PluginTestHelper 6 + include SoftwareCommunitiesPlugin::PluginTestHelper
7 7
8 should "Return original license_info when license is not 'Another'" do 8 should "Return original license_info when license is not 'Another'" do
9 @software_info = create_software_info("software_test") 9 @software_info = create_software_info("software_test")
@@ -41,4 +41,4 @@ class SoftwareInfoValidationTest &lt; ActiveSupport::TestCase @@ -41,4 +41,4 @@ class SoftwareInfoValidationTest &lt; ActiveSupport::TestCase
41 assert_equal @software_info.license_info.link, another_license_link 41 assert_equal @software_info.license_info.link, another_license_link
42 end 42 end
43 43
44 -end  
45 \ No newline at end of file 44 \ No newline at end of file
  45 +end
src/noosfero-spb/software_communities/test/unit/software_info_validation_test.rb
@@ -9,29 +9,29 @@ class SoftwareInfoValidationTest &lt; ActiveSupport::TestCase @@ -9,29 +9,29 @@ class SoftwareInfoValidationTest &lt; ActiveSupport::TestCase
9 :name => 'New Software' 9 :name => 'New Software'
10 ) 10 )
11 11
12 - @language = ProgrammingLanguage.new(:name => 'C++') 12 + @language = SoftwareCommunitiesPlugin::ProgrammingLanguage.new(:name => 'C++')
13 @language.save 13 @language.save
14 - @software_language = SoftwareLanguage.new( 14 + @software_language = SoftwareCommunitiesPlugin::SoftwareLanguage.new(
15 :version => '1' 15 :version => '1'
16 ) 16 )
17 @software_language.programming_language = @language 17 @software_language.programming_language = @language
18 @software_language.save 18 @software_language.save
19 19
20 - @database = DatabaseDescription.new(:name => 'Oracle') 20 + @database = SoftwareCommunitiesPlugin::DatabaseDescription.new(:name => 'Oracle')
21 @database.save 21 @database.save
22 - @software_database = SoftwareDatabase.new( 22 + @software_database = SoftwareCommunitiesPlugin::SoftwareDatabase.new(
23 :version => '2' 23 :version => '2'
24 ) 24 )
25 @software_database.database_description = @database 25 @software_database.database_description = @database
26 @software_database.save 26 @software_database.save
27 27
28 - @operating_system_name = OperatingSystemName.new(:name => 'Debian') 28 + @operating_system_name = SoftwareCommunitiesPlugin::OperatingSystemName.new(:name => 'Debian')
29 @operating_system_name.save 29 @operating_system_name.save
30 - @operating_system = OperatingSystem.new(:version => '1.0') 30 + @operating_system = SoftwareCommunitiesPlugin::OperatingSystem.new(:version => '1.0')
31 @operating_system.operating_system_name = @operating_system_name 31 @operating_system.operating_system_name = @operating_system_name
32 @operating_system.save 32 @operating_system.save
33 33
34 - @software_info = SoftwareInfo.new( 34 + @software_info = SoftwareCommunitiesPlugin::SoftwareInfo.new(
35 :acronym => "SFTW", 35 :acronym => "SFTW",
36 :e_mag => true, 36 :e_mag => true,
37 :icp_brasil => true, 37 :icp_brasil => true,
@@ -53,13 +53,13 @@ class SoftwareInfoValidationTest &lt; ActiveSupport::TestCase @@ -53,13 +53,13 @@ class SoftwareInfoValidationTest &lt; ActiveSupport::TestCase
53 end 53 end
54 54
55 def teardown 55 def teardown
56 - ProgrammingLanguage.destroy_all  
57 - SoftwareLanguage.destroy_all  
58 - DatabaseDescription.destroy_all  
59 - SoftwareDatabase.destroy_all  
60 - OperatingSystem.destroy_all  
61 - OperatingSystemName.destroy_all  
62 - SoftwareInfo.destroy_all 56 + SoftwareCommunitiesPlugin::ProgrammingLanguage.destroy_all
  57 + SoftwareCommunitiesPlugin::SoftwareLanguage.destroy_all
  58 + SoftwareCommunitiesPlugin::DatabaseDescription.destroy_all
  59 + SoftwareCommunitiesPlugin::SoftwareDatabase.destroy_all
  60 + SoftwareCommunitiesPlugin::OperatingSystem.destroy_all
  61 + SoftwareCommunitiesPlugin::OperatingSystemName.destroy_all
  62 + SoftwareCommunitiesPlugin::SoftwareInfo.destroy_all
63 end 63 end
64 64
65 should 'Save SoftwareInfo if all fields are filled' do 65 should 'Save SoftwareInfo if all fields are filled' do
src/noosfero-spb/software_communities/test/unit/software_language_helper_test.rb
@@ -3,8 +3,8 @@ require File.dirname(__FILE__) + &#39;/../../../../test/test_helper&#39; @@ -3,8 +3,8 @@ require File.dirname(__FILE__) + &#39;/../../../../test/test_helper&#39;
3 class SoftwareLanguageHelperTest < ActiveSupport::TestCase 3 class SoftwareLanguageHelperTest < ActiveSupport::TestCase
4 4
5 def setup 5 def setup
6 - pl1 = ProgrammingLanguage.create(:name => "Python")  
7 - pl2 = ProgrammingLanguage.create(:name => "Java") 6 + pl1 = SoftwareCommunitiesPlugin::ProgrammingLanguage.create(:name => "Python")
  7 + pl2 = SoftwareCommunitiesPlugin::ProgrammingLanguage.create(:name => "Java")
8 8
9 @software_language_objects = [ 9 @software_language_objects = [
10 {:programming_language_id => pl1.id.to_s ,:version => "2.0"}, 10 {:programming_language_id => pl1.id.to_s ,:version => "2.0"},
@@ -15,35 +15,35 @@ class SoftwareLanguageHelperTest &lt; ActiveSupport::TestCase @@ -15,35 +15,35 @@ class SoftwareLanguageHelperTest &lt; ActiveSupport::TestCase
15 15
16 def teardown 16 def teardown
17 @software_language_objects = nil 17 @software_language_objects = nil
18 - ProgrammingLanguage.destroy_all 18 + SoftwareCommunitiesPlugin::ProgrammingLanguage.destroy_all
19 end 19 end
20 20
21 should "return an empty list" do 21 should "return an empty list" do
22 empty_list = [] 22 empty_list = []
23 - assert_equal [], SoftwareLanguageHelper.list_language(empty_list) 23 + assert_equal [], SoftwareCommunitiesPlugin::SoftwareLanguageHelper.list_language(empty_list)
24 end 24 end
25 25
26 should "return a list with current software language objects" do 26 should "return a list with current software language objects" do
27 list_compare = [] 27 list_compare = []
28 - softwares = SoftwareLanguageHelper.list_language(@software_language_objects) 28 + softwares = SoftwareCommunitiesPlugin::SoftwareLanguageHelper.list_language(@software_language_objects)
29 assert_equal list_compare.class, softwares.class 29 assert_equal list_compare.class, softwares.class
30 end 30 end
31 31
32 should "have same information from the list passed as parameter" do 32 should "have same information from the list passed as parameter" do
33 - list_compare = SoftwareLanguageHelper.list_language(@software_language_objects) 33 + list_compare = SoftwareCommunitiesPlugin::SoftwareLanguageHelper.list_language(@software_language_objects)
34 lang_id = @software_language_objects.first[:programming_language_id].to_i 34 lang_id = @software_language_objects.first[:programming_language_id].to_i
35 35
36 assert_equal lang_id, list_compare.first.programming_language_id 36 assert_equal lang_id, list_compare.first.programming_language_id
37 end 37 end
38 38
39 should "return a list with the same size of the parameter" do 39 should "return a list with the same size of the parameter" do
40 - list_compare = SoftwareLanguageHelper.list_language(@software_language_objects) 40 + list_compare = SoftwareCommunitiesPlugin::SoftwareLanguageHelper.list_language(@software_language_objects)
41 assert_equal @software_language_objects.count, list_compare.count 41 assert_equal @software_language_objects.count, list_compare.count
42 end 42 end
43 43
44 should "return false if list_language are empty or null" do 44 should "return false if list_language are empty or null" do
45 list_compare = [] 45 list_compare = []
46 - assert_equal false,SoftwareLanguageHelper.valid_list_language?(list_compare) 46 + assert_equal false, SoftwareCommunitiesPlugin::SoftwareLanguageHelper.valid_list_language?(list_compare)
47 end 47 end
48 48
49 should "remove invalid tables from the list" do 49 should "remove invalid tables from the list" do
@@ -53,7 +53,7 @@ class SoftwareLanguageHelperTest &lt; ActiveSupport::TestCase @@ -53,7 +53,7 @@ class SoftwareLanguageHelperTest &lt; ActiveSupport::TestCase
53 }) 53 })
54 54
55 software_language_objects_length = @software_language_objects.count 55 software_language_objects_length = @software_language_objects.count
56 - list_compare = SoftwareLanguageHelper.list_language(@software_language_objects) 56 + list_compare = SoftwareCommunitiesPlugin::SoftwareLanguageHelper.list_language(@software_language_objects)
57 57
58 assert_equal software_language_objects_length-1, list_compare.count 58 assert_equal software_language_objects_length-1, list_compare.count
59 end 59 end
src/noosfero-spb/software_communities/test/unit/software_language_validation.rb
@@ -9,7 +9,7 @@ class SoftwareLanguageValidationTest &lt; ActiveSupport::TestCase @@ -9,7 +9,7 @@ class SoftwareLanguageValidationTest &lt; ActiveSupport::TestCase
9 9
10 def teardown 10 def teardown
11 @software_info = nil 11 @software_info = nil
12 - SoftwareInfo.destroy_all 12 + SoftwareCommunitiesPlugin::SoftwareInfo.destroy_all
13 end 13 end
14 14
15 should "Save SoftwareLanguage if version and prog_language are filled" do 15 should "Save SoftwareLanguage if version and prog_language are filled" do
@@ -38,15 +38,15 @@ class SoftwareLanguageValidationTest &lt; ActiveSupport::TestCase @@ -38,15 +38,15 @@ class SoftwareLanguageValidationTest &lt; ActiveSupport::TestCase
38 private 38 private
39 39
40 def create_software_language 40 def create_software_language
41 - software_language = SoftwareLanguage.new 41 + software_language = SoftwareCommunitiesPlugin::SoftwareLanguage.new
42 software_language.software_info = @software_info 42 software_language.software_info = @software_info
43 - software_language.programming_language = ProgrammingLanguage.last 43 + software_language.programming_language = SoftwareCommunitiesPlugin::ProgrammingLanguage.last
44 software_language.version = "version" 44 software_language.version = "version"
45 software_language 45 software_language
46 end 46 end
47 47
48 def create_software_info 48 def create_software_info
49 - software_info = SoftwareInfo.new 49 + software_info = SoftwareCommunitiesPlugin::SoftwareInfo.new
50 software_info.community_id = fast_create(Community).id 50 software_info.community_id = fast_create(Community).id
51 software_info.community.name = 'Noosfero' 51 software_info.community.name = 'Noosfero'
52 software_info.e_mag = true 52 software_info.e_mag = true
@@ -61,9 +61,9 @@ class SoftwareLanguageValidationTest &lt; ActiveSupport::TestCase @@ -61,9 +61,9 @@ class SoftwareLanguageValidationTest &lt; ActiveSupport::TestCase
61 end 61 end
62 62
63 def create_programming_language 63 def create_programming_language
64 - ProgrammingLanguage.create(:name=>"C")  
65 - ProgrammingLanguage.create(:name=>"C++")  
66 - ProgrammingLanguage.create(:name=>"Ruby")  
67 - ProgrammingLanguage.create(:name=>"Python") 64 + SoftwareCommunitiesPlugin::ProgrammingLanguage.create(:name=>"C")
  65 + SoftwareCommunitiesPlugin::ProgrammingLanguage.create(:name=>"C++")
  66 + SoftwareCommunitiesPlugin::ProgrammingLanguage.create(:name=>"Ruby")
  67 + SoftwareCommunitiesPlugin::ProgrammingLanguage.create(:name=>"Python")
68 end 68 end
69 end 69 end
src/noosfero-spb/software_communities/test/unit/software_license_info_test.rb
@@ -3,7 +3,7 @@ require File.dirname(__FILE__) + &#39;/../../../../test/test_helper&#39; @@ -3,7 +3,7 @@ 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( 6 + @software_license_info = SoftwareCommunitiesPlugin::LicenseInfo.create(
7 :version => "GPL", 7 :version => "GPL",
8 :link => "www.gpl2.com" 8 :link => "www.gpl2.com"
9 ) 9 )
@@ -11,7 +11,7 @@ class SoftwareDatabaseTest &lt; ActiveSupport::TestCase @@ -11,7 +11,7 @@ class SoftwareDatabaseTest &lt; ActiveSupport::TestCase
11 end 11 end
12 12
13 should "not save if license info version is empty" do 13 should "not save if license info version is empty" do
14 - @software_license_info = LicenseInfo.create( 14 + @software_license_info = SoftwareCommunitiesPlugin::LicenseInfo.create(
15 :version => "GPL", 15 :version => "GPL",
16 :link => "www.gpl2.com" 16 :link => "www.gpl2.com"
17 ) 17 )
@@ -20,7 +20,7 @@ class SoftwareDatabaseTest &lt; ActiveSupport::TestCase @@ -20,7 +20,7 @@ class SoftwareDatabaseTest &lt; ActiveSupport::TestCase
20 end 20 end
21 21
22 should "save if link is empty" do 22 should "save if link is empty" do
23 - @software_license_info = LicenseInfo.create( 23 + @software_license_info = SoftwareCommunitiesPlugin::LicenseInfo.create(
24 :version => "GPL", 24 :version => "GPL",
25 :link => "www.gpl2.com") 25 :link => "www.gpl2.com")
26 @software_license_info.link = nil 26 @software_license_info.link = nil
src/noosfero-spb/software_communities/test/unit/software_registration_test.rb
@@ -9,14 +9,14 @@ class SoftwareRegistrationTest &lt; ActiveSupport::TestCase @@ -9,14 +9,14 @@ class SoftwareRegistrationTest &lt; ActiveSupport::TestCase
9 9
10 def teardown 10 def teardown
11 Community.destroy_all 11 Community.destroy_all
12 - SoftwareInfo.destroy_all 12 + SoftwareCommunitiesPlugin::SoftwareInfo.destroy_all
13 Task.destroy_all 13 Task.destroy_all
14 end 14 end
15 15
16 should 'include software registration task if is admin' do 16 should 'include software registration task if is admin' do
17 person = create_user('molly').person 17 person = create_user('molly').person
18 @environment.add_admin(person) 18 @environment.add_admin(person)
19 - task = CreateSoftware.create!( 19 + task = SoftwareCommunitiesPlugin::CreateSoftware.create!(
20 :name => "Teste One", 20 :name => "Teste One",
21 :requestor => person, 21 :requestor => person,
22 :environment => @environment 22 :environment => @environment
@@ -27,16 +27,16 @@ class SoftwareRegistrationTest &lt; ActiveSupport::TestCase @@ -27,16 +27,16 @@ class SoftwareRegistrationTest &lt; ActiveSupport::TestCase
27 should 'create software when admin accept software create task' do 27 should 'create software when admin accept software create task' do
28 person = create_user('Pedro').person 28 person = create_user('Pedro').person
29 @environment.add_admin(person) 29 @environment.add_admin(person)
30 - task = CreateSoftware.create!( 30 + task = SoftwareCommunitiesPlugin::CreateSoftware.create!(
31 :name => "Teste Two", 31 :name => "Teste Two",
32 :requestor => person, 32 :requestor => person,
33 :environment => @environment, 33 :environment => @environment,
34 :finality => "something" 34 :finality => "something"
35 ) 35 )
36 36
37 - software_count = SoftwareInfo.count 37 + software_count = SoftwareCommunitiesPlugin::SoftwareInfo.count
38 task.finish 38 task.finish
39 39
40 - assert_equal software_count+1, SoftwareInfo.count 40 + assert_equal software_count+1, SoftwareCommunitiesPlugin::SoftwareInfo.count
41 end 41 end
42 end 42 end
src/noosfero-spb/software_communities/test/unit/software_tab_data_block_test.rb
@@ -2,7 +2,7 @@ require File.dirname(__FILE__) + &#39;/../../../../test/test_helper&#39; @@ -2,7 +2,7 @@ require File.dirname(__FILE__) + &#39;/../../../../test/test_helper&#39;
2 require File.dirname(__FILE__) + '/../helpers/plugin_test_helper' 2 require File.dirname(__FILE__) + '/../helpers/plugin_test_helper'
3 3
4 class SoftwareTabDataBlockTest < ActiveSupport::TestCase 4 class SoftwareTabDataBlockTest < ActiveSupport::TestCase
5 - include PluginTestHelper 5 + include SoftwareCommunitiesPlugin::PluginTestHelper
6 6
7 def setup 7 def setup
8 @software_info = create_software_info("A new Software") 8 @software_info = create_software_info("A new Software")
@@ -14,15 +14,15 @@ class SoftwareTabDataBlockTest &lt; ActiveSupport::TestCase @@ -14,15 +14,15 @@ class SoftwareTabDataBlockTest &lt; ActiveSupport::TestCase
14 @soft_community.blogs << Blog.new(:name=>"Second blog") 14 @soft_community.blogs << Blog.new(:name=>"Second blog")
15 @soft_community.save! 15 @soft_community.save!
16 16
17 - SoftwareTabDataBlock.any_instance.stubs(:owner).returns(@soft_community) 17 + SoftwareCommunitiesPlugin::SoftwareTabDataBlock.any_instance.stubs(:owner).returns(@soft_community)
18 end 18 end
19 19
20 should "get its owner blogs" do 20 should "get its owner blogs" do
21 - assert_equal @soft_community.blogs, SoftwareTabDataBlock.new.blogs 21 + assert_equal @soft_community.blogs, SoftwareCommunitiesPlugin::SoftwareTabDataBlock.new.blogs
22 end 22 end
23 23
24 should "actual_blog get the first blog if it is not defined" do 24 should "actual_blog get the first blog if it is not defined" do
25 - assert_equal @soft_community.blogs.first, SoftwareTabDataBlock.new.actual_blog 25 + assert_equal @soft_community.blogs.first, SoftwareCommunitiesPlugin::SoftwareTabDataBlock.new.actual_blog
26 end 26 end
27 27
28 should "actual_blog get the defined community blog" do 28 should "actual_blog get the defined community blog" do
@@ -46,13 +46,13 @@ class SoftwareTabDataBlockTest &lt; ActiveSupport::TestCase @@ -46,13 +46,13 @@ class SoftwareTabDataBlockTest &lt; ActiveSupport::TestCase
46 soft_tab_data = create_software_tab_data_block(last_blog) 46 soft_tab_data = create_software_tab_data_block(last_blog)
47 craete_sample_posts(last_blog, 6) 47 craete_sample_posts(last_blog, 6)
48 48
49 - assert_equal SoftwareTabDataBlock::TOTAL_POSTS_DYSPLAYED, soft_tab_data.posts.count 49 + assert_equal SoftwareCommunitiesPlugin::SoftwareTabDataBlock::TOTAL_POSTS_DYSPLAYED, soft_tab_data.posts.count
50 end 50 end
51 51
52 private 52 private
53 53
54 def create_software_tab_data_block blog 54 def create_software_tab_data_block blog
55 - soft_tab_data = SoftwareTabDataBlock.new 55 + soft_tab_data = SoftwareCommunitiesPlugin::SoftwareTabDataBlock.new
56 soft_tab_data.displayed_blog = blog.id 56 soft_tab_data.displayed_blog = blog.id
57 soft_tab_data 57 soft_tab_data
58 end 58 end
src/noosfero-spb/software_communities/test/unit/softwares_block_test.rb
@@ -2,22 +2,22 @@ require File.dirname(__FILE__) + &#39;/../../../../test/test_helper&#39; @@ -2,22 +2,22 @@ require File.dirname(__FILE__) + &#39;/../../../../test/test_helper&#39;
2 require File.dirname(__FILE__) + '/../helpers/plugin_test_helper' 2 require File.dirname(__FILE__) + '/../helpers/plugin_test_helper'
3 3
4 class SoftwaresBlockTest < ActiveSupport::TestCase 4 class SoftwaresBlockTest < ActiveSupport::TestCase
5 - include PluginTestHelper 5 + include SoftwareCommunitiesPlugin::PluginTestHelper
6 should 'inherit from ProfileListBlock' do 6 should 'inherit from ProfileListBlock' do
7 - assert_kind_of ProfileListBlock, SoftwaresBlock.new 7 + assert_kind_of ProfileListBlock, SoftwareCommunitiesPlugin::SoftwaresBlock.new
8 end 8 end
9 9
10 should 'declare its default title' do 10 should 'declare its default title' do
11 - SoftwaresBlock.any_instance.stubs(:profile_count).returns(0)  
12 - assert_not_equal ProfileListBlock.new.default_title, SoftwaresBlock.new.default_title 11 + SoftwareCommunitiesPlugin::SoftwaresBlock.any_instance.stubs(:profile_count).returns(0)
  12 + assert_not_equal ProfileListBlock.new.default_title, SoftwareCommunitiesPlugin::SoftwaresBlock.new.default_title
13 end 13 end
14 14
15 should 'describe itself' do 15 should 'describe itself' do
16 - assert_not_equal ProfileListBlock.description, SoftwaresBlock.description 16 + assert_not_equal ProfileListBlock.description, SoftwareCommunitiesPlugin::SoftwaresBlock.description
17 end 17 end
18 18
19 should 'give empty footer on unsupported owner type' do 19 should 'give empty footer on unsupported owner type' do
20 - block = SoftwaresBlock.new 20 + block = SoftwareCommunitiesPlugin::SoftwaresBlock.new
21 block.expects(:owner).returns(1) 21 block.expects(:owner).returns(1)
22 assert_equal '', block.footer 22 assert_equal '', block.footer
23 end 23 end
@@ -34,7 +34,7 @@ class SoftwaresBlockTest &lt; ActiveSupport::TestCase @@ -34,7 +34,7 @@ class SoftwaresBlockTest &lt; ActiveSupport::TestCase
34 software_info = create_software_info("new software") 34 software_info = create_software_info("new software")
35 software_info.community.add_member(user) 35 software_info.community.add_member(user)
36 36
37 - block = SoftwaresBlock.new 37 + block = SoftwareCommunitiesPlugin::SoftwaresBlock.new
38 block.expects(:owner).at_least_once.returns(user) 38 block.expects(:owner).at_least_once.returns(user)
39 39
40 assert_equivalent [software_info.community], block.profiles 40 assert_equivalent [software_info.community], block.profiles