diff --git a/src/noosfero-spb/software_communities/test/unit/categories_and_tags_block_test.rb b/src/noosfero-spb/software_communities/test/unit/categories_and_tags_block_test.rb index a7e0bef..9c8186e 100644 --- a/src/noosfero-spb/software_communities/test/unit/categories_and_tags_block_test.rb +++ b/src/noosfero-spb/software_communities/test/unit/categories_and_tags_block_test.rb @@ -1,19 +1,19 @@ require File.dirname(__FILE__) + '/../../../../test/test_helper' require File.dirname(__FILE__) + '/../helpers/plugin_test_helper' -class CategoriesAndTagsBlockTest < ActiveSupport::TestCase +class SoftwareCommunitiesPlugin::CategoriesAndTagsBlockTest < ActiveSupport::TestCase include PluginTestHelper should 'inherit from Block' do - assert_kind_of Block, CategoriesAndTagsBlock.new + assert_kind_of Block, SoftwareCommunitiesPlugin::CategoriesAndTagsBlock.new end should 'declare its default title' do - CategoriesAndTagsBlock.any_instance.stubs(:profile_count).returns(0) - assert_equal Block.new.default_title, CategoriesAndTagsBlock.new.default_title + SoftwareCommunitiesPlugin::CategoriesAndTagsBlock.any_instance.stubs(:profile_count).returns(0) + assert_equal Block.new.default_title, SoftwareCommunitiesPlugin::CategoriesAndTagsBlock.new.default_title end should 'describe itself' do - assert_not_equal Block.description, CategoriesAndTagsBlock.description + assert_not_equal Block.description, SoftwareCommunitiesPlugin::CategoriesAndTagsBlock.description end end diff --git a/src/noosfero-spb/software_communities/test/unit/categories_software_block_test.rb b/src/noosfero-spb/software_communities/test/unit/categories_software_block_test.rb index b02f9b4..979ee52 100644 --- a/src/noosfero-spb/software_communities/test/unit/categories_software_block_test.rb +++ b/src/noosfero-spb/software_communities/test/unit/categories_software_block_test.rb @@ -4,16 +4,16 @@ require File.dirname(__FILE__) + '/../helpers/plugin_test_helper' class CategoriesSoftwareBlockTest < ActiveSupport::TestCase include PluginTestHelper should 'inherit from Block' do - assert_kind_of Block, CategoriesSoftwareBlock.new + assert_kind_of Block, SoftwareCommunitiesPlugin::CategoriesSoftwareBlock.new end should 'declare its default title' do - CategoriesSoftwareBlock.any_instance.stubs(:profile_count).returns(0) - assert_equal Block.new.default_title, CategoriesSoftwareBlock.new.default_title + SoftwareCommunitiesPlugin::CategoriesSoftwareBlock.any_instance.stubs(:profile_count).returns(0) + assert_equal Block.new.default_title, SoftwareCommunitiesPlugin::CategoriesSoftwareBlock.new.default_title end should 'describe itself' do - assert_not_equal Block.description, CategoriesSoftwareBlock.description + assert_not_equal Block.description, SoftwareCommunitiesPlugin::CategoriesSoftwareBlock.description end end diff --git a/src/noosfero-spb/software_communities/test/unit/communities_block_test.rb b/src/noosfero-spb/software_communities/test/unit/communities_block_test.rb index e10251b..12675ee 100644 --- a/src/noosfero-spb/software_communities/test/unit/communities_block_test.rb +++ b/src/noosfero-spb/software_communities/test/unit/communities_block_test.rb @@ -13,12 +13,12 @@ class CommunitiesBlockTest < ActiveSupport::TestCase @community.add_member(@person) - @comminities_block = CommunitiesBlock.new + @comminities_block = SoftwareCommunitiesPlugin::CommunitiesBlock.new @comminities_block.expects(:owner).at_least_once.returns(@person) end def teardown - CommunitiesBlock.destroy_all + SoftwareCommunitiesPlugin::CommunitiesBlock.destroy_all @person = nil @community = nil @software_info = nil diff --git a/src/noosfero-spb/software_communities/test/unit/create_software_test.rb b/src/noosfero-spb/software_communities/test/unit/create_software_test.rb index 75e8af6..5cc1958 100644 --- a/src/noosfero-spb/software_communities/test/unit/create_software_test.rb +++ b/src/noosfero-spb/software_communities/test/unit/create_software_test.rb @@ -7,11 +7,11 @@ class CreateSoftwareTest < ActiveSupport::TestCase end should 'be a task' do - ok { CreateSoftware.new.kind_of?(Task) } + ok { SoftwareCommunitiesPlugin::CreateSoftware.new.kind_of?(Task) } end should 'require a requestor' do - task = CreateSoftware.new(:name => 'Software Test', :target => Environment.default) + task = SoftwareCommunitiesPlugin::CreateSoftware.new(:name => 'Software Test', :target => Environment.default) task.valid? assert task.errors[:requestor_id.to_s].present? @@ -24,7 +24,7 @@ class CreateSoftwareTest < ActiveSupport::TestCase end should 'actually create new software community when confirmed' do - task = CreateSoftware.create!(:name => 'Software Test', :target => Environment.default, :requestor => @requestor, :finality => "Any") + task = SoftwareCommunitiesPlugin::CreateSoftware.create!(:name => 'Software Test', :target => Environment.default, :requestor => @requestor, :finality => "Any") assert_difference 'SoftwareInfo.count' do assert_difference 'Community.count' do @@ -36,7 +36,7 @@ class CreateSoftwareTest < ActiveSupport::TestCase end should 'create new software community with all informed data when confirmed' do - task = CreateSoftware.create!(:name => 'Software Test', :target => Environment.default, :requestor => @requestor, :finality => "Any", :repository_link => "#", ) + task = SoftwareCommunitiesPlugin::CreateSoftware.create!(:name => 'Software Test', :target => Environment.default, :requestor => @requestor, :finality => "Any", :repository_link => "#", ) task.finish software = Community["software-test"].software_info @@ -47,7 +47,7 @@ class CreateSoftwareTest < ActiveSupport::TestCase end should 'override message methods from Task' do - task = CreateSoftware.create!(:name => 'Software Test', :target => Environment.default, :requestor => @requestor, :finality => "Any") + task = SoftwareCommunitiesPlugin::CreateSoftware.create!(:name => 'Software Test', :target => Environment.default, :requestor => @requestor, :finality => "Any") task.finish @@ -59,13 +59,13 @@ class CreateSoftwareTest < ActiveSupport::TestCase end should 'report as approved when approved' do - request = CreateSoftware.new + request = SoftwareCommunitiesPlugin::CreateSoftware.new request.stubs(:status).returns(Task::Status::FINISHED) assert request.approved? end should 'report as rejected when rejected' do - request = CreateSoftware.new + request = SoftwareCommunitiesPlugin::CreateSoftware.new request.stubs(:status).returns(Task::Status::CANCELLED) assert request.rejected? end diff --git a/src/noosfero-spb/software_communities/test/unit/database_helper_test.rb b/src/noosfero-spb/software_communities/test/unit/database_helper_test.rb index d7f2444..382db9e 100644 --- a/src/noosfero-spb/software_communities/test/unit/database_helper_test.rb +++ b/src/noosfero-spb/software_communities/test/unit/database_helper_test.rb @@ -3,8 +3,8 @@ require File.dirname(__FILE__) + '/../../../../test/test_helper' class DatabaseHelperTest < ActiveSupport::TestCase def setup - dd1 = DatabaseDescription.create(:name => "Oracle") - dd2 = DatabaseDescription.create!(:name => "MySQL") + dd1 = SoftwareCommunitiesPlugin::DatabaseDescription.create(:name => "Oracle") + dd2 = SoftwareCommunitiesPlugin::DatabaseDescription.create!(:name => "MySQL") @database_objects = [ {:database_description_id => dd1.id.to_s ,:version => "2.0"}, @@ -14,35 +14,35 @@ class DatabaseHelperTest < ActiveSupport::TestCase def teardown @database_objects = nil - SoftwareDatabase.destroy_all - DatabaseDescription.destroy_all + SoftwareCommunitiesPlugin::SoftwareDatabase.destroy_all + SoftwareCommunitiesPlugin::DatabaseDescription.destroy_all end should "return an empty list" do empty_list = [] - assert_equal [], DatabaseHelper.list_database(empty_list) + assert_equal [], SoftwareCommunitiesPlugin::DatabaseHelper.list_database(empty_list) end should "return a list with current database objects" do list_compare = [] - db_tables = DatabaseHelper.list_database(@database_objects) + db_tables = SoftwareCommunitiesPlugin::DatabaseHelper.list_database(@database_objects) assert_equal list_compare.class, db_tables.class end should "have same information from the list passed as parameter" do - list_compare = DatabaseHelper.list_database(@database_objects) + list_compare = SoftwareCommunitiesPlugin::DatabaseHelper.list_database(@database_objects) db_objects_id = @database_objects.first[:database_description_id] assert_equal db_objects_id.to_i, list_compare.first.database_description_id end should "return a list with the same size of the parameter" do - list_compare = DatabaseHelper.list_database(@database_objects) + list_compare = SoftwareCommunitiesPlugin::DatabaseHelper.list_database(@database_objects) assert_equal @database_objects.count, list_compare.count end should "return false if list_database are empty or null" do list_compare = [] - assert_equal false,DatabaseHelper.valid_list_database?(list_compare) + assert_equal false, SoftwareCommunitiesPlugin::DatabaseHelper.valid_list_database?(list_compare) end should "remove invalid tables from the list" do @@ -52,7 +52,7 @@ class DatabaseHelperTest < ActiveSupport::TestCase }) database_objects_length = @database_objects.count - list_compare = DatabaseHelper.list_database(@database_objects) + list_compare = SoftwareCommunitiesPlugin::DatabaseHelper.list_database(@database_objects) assert_equal list_compare.count, database_objects_length-1 end end diff --git a/src/noosfero-spb/software_communities/test/unit/database_validation_test.rb b/src/noosfero-spb/software_communities/test/unit/database_validation_test.rb index 5466779..abfa634 100644 --- a/src/noosfero-spb/software_communities/test/unit/database_validation_test.rb +++ b/src/noosfero-spb/software_communities/test/unit/database_validation_test.rb @@ -3,8 +3,8 @@ require File.dirname(__FILE__) + '/../../../../test/test_helper' class DatabaseValidationTest < ActiveSupport::TestCase def setup - @database_desc = DatabaseDescription.create(:name => "ABC") - @database = SoftwareDatabase.new + @database_desc = SoftwareCommunitiesPlugin::DatabaseDescription.create(:name => "ABC") + @database = SoftwareCommunitiesPlugin::SoftwareDatabase.new @database.database_description = @database_desc @database.version = "MYSQL" @database @@ -12,8 +12,8 @@ class DatabaseValidationTest < ActiveSupport::TestCase def teardown @database = nil - DatabaseDescription.destroy_all - SoftwareDatabase.destroy_all + SoftwareCommunitiesPlugin::DatabaseDescription.destroy_all + SoftwareCommunitiesPlugin::SoftwareDatabase.destroy_all end should "Save database if all fields are filled" do diff --git a/src/noosfero-spb/software_communities/test/unit/download_block_test.rb b/src/noosfero-spb/software_communities/test/unit/download_block_test.rb index adfcdd3..846d213 100644 --- a/src/noosfero-spb/software_communities/test/unit/download_block_test.rb +++ b/src/noosfero-spb/software_communities/test/unit/download_block_test.rb @@ -4,16 +4,16 @@ require File.dirname(__FILE__) + '/../helpers/plugin_test_helper' class DownloadBlockTest < ActiveSupport::TestCase include PluginTestHelper should 'inherit from Block' do - assert_kind_of Block, DownloadBlock.new + assert_kind_of Block, SoftwareCommunitiesPlugin::DownloadBlock.new end should 'declare its default title' do - DownloadBlock.any_instance.stubs(:profile_count).returns(0) - assert_equal Block.new.default_title, DownloadBlock.new.default_title + SoftwareCommunitiesPlugin::DownloadBlock.any_instance.stubs(:profile_count).returns(0) + assert_equal Block.new.default_title, SoftwareCommunitiesPlugin::DownloadBlock.new.default_title end should 'describe itself' do - assert_not_equal Block.description, DownloadBlock.description + assert_not_equal Block.description, SoftwareCommunitiesPlugin::DownloadBlock.description end should 'have software info to download it' do @@ -24,7 +24,7 @@ class DownloadBlockTest < ActiveSupport::TestCase link2 = "gitlab.com/teste/2" name2 = "Test Software2" - block = DownloadBlock.create(:downloads => [{:name => name1, :link => link1}, {:name => name2, :link => link2}]) + block = SoftwareCommunitiesPlugin::DownloadBlock.create(:downloads => [{:name => name1, :link => link1}, {:name => name2, :link => link2}]) assert_equal block.downloads[0][:link], link1, "Link should not be empty" assert_equal block.downloads[0][:name], name1, "Name should not be empty" diff --git a/src/noosfero-spb/software_communities/test/unit/download_test.rb b/src/noosfero-spb/software_communities/test/unit/download_test.rb index 4b301fd..570e0cc 100644 --- a/src/noosfero-spb/software_communities/test/unit/download_test.rb +++ b/src/noosfero-spb/software_communities/test/unit/download_test.rb @@ -26,8 +26,8 @@ class DownloadTest < ActiveSupport::TestCase end should "Set as 0(zero) total_downloads if it is not given" do - without_total_downloads = Download.new({}) - with_total_downloads = Download.new(@downloads_sample_data.last) + without_total_downloads = SoftwareCommunitiesPlugin::Download.new({}) + with_total_downloads = SoftwareCommunitiesPlugin::Download.new(@downloads_sample_data.last) assert_equal 0, without_total_downloads.total_downloads assert_equal @downloads_sample_data.last[:total_downloads], with_total_downloads.total_downloads @@ -35,14 +35,14 @@ class DownloadTest < ActiveSupport::TestCase should "Remove downloads without a name" do @downloads_sample_data[1] = @downloads_sample_data[1].slice! :name - downloads = Download.validate_download_list @downloads_sample_data + downloads = SoftwareCommunitiesPlugin::Download.validate_download_list @downloads_sample_data assert_equal 1, downloads.size assert_equal @downloads_sample_data[0][:name], downloads[0][:name] end should "Only set total_downloads if the value is integer" do - download = Download.new(@downloads_sample_data.last) + download = SoftwareCommunitiesPlugin::Download.new(@downloads_sample_data.last) download.total_downloads = "456" assert_not_equal 456, download.total_downloads diff --git a/src/noosfero-spb/software_communities/test/unit/library_helper_test.rb b/src/noosfero-spb/software_communities/test/unit/library_helper_test.rb index 28e58e3..0f80fec 100644 --- a/src/noosfero-spb/software_communities/test/unit/library_helper_test.rb +++ b/src/noosfero-spb/software_communities/test/unit/library_helper_test.rb @@ -15,38 +15,38 @@ class LibraryHelperTest < ActiveSupport::TestCase should "return an empty list" do empty_list = [] - assert_equal [],LibraryHelper.list_library(empty_list) + assert_equal [], SoftwareCommunitiesPlugin::LibraryHelper.list_library(empty_list) end should "return a list with current library objects" do list_compare = [] - lib_table = LibraryHelper.list_library(@license_objects) + lib_table = SoftwareCommunitiesPlugin::LibraryHelper.list_library(@license_objects) assert_equal list_compare.class, lib_table.class end should "have same information from the list passed as parameter" do - list_compare = LibraryHelper.list_library(@license_objects) + list_compare = SoftwareCommunitiesPlugin::LibraryHelper.list_library(@license_objects) assert_equal @license_objects.first[:name], list_compare.first.name end should "return a list with the same size of the parameter" do - list_compare = LibraryHelper.list_library(@license_objects) + list_compare = SoftwareCommunitiesPlugin::LibraryHelper.list_library(@license_objects) assert_equal @license_objects.count, list_compare.count end should "return false if list_database are empty or null" do list_compare = [] - assert_equal true, LibraryHelper.valid_list_library?(list_compare) + assert_equal true, SoftwareCommunitiesPlugin::LibraryHelper.valid_list_library?(list_compare) end should "return a html text with license name equals to linux" do libraries = [] - library_description = Library.new + library_description = SoftwareCommunitiesPlugin::Library.new library_description.name = "Lib" libraries << library_description - lib_table = LibraryHelper.libraries_as_tables(libraries) + lib_table = SoftwareCommunitiesPlugin::LibraryHelper.libraries_as_tables(libraries) assert_not_nil lib_table.first.call.index("lib") end diff --git a/src/noosfero-spb/software_communities/test/unit/library_validation_test.rb b/src/noosfero-spb/software_communities/test/unit/library_validation_test.rb index f45cc9e..d56da08 100644 --- a/src/noosfero-spb/software_communities/test/unit/library_validation_test.rb +++ b/src/noosfero-spb/software_communities/test/unit/library_validation_test.rb @@ -3,7 +3,7 @@ require File.dirname(__FILE__) + '/../../../../test/test_helper' class LibraryValidationTest < ActiveSupport::TestCase def setup - @library = Library.new + @library = SoftwareCommunitiesPlugin::Library.new @library.name = "name" @library.version = "version" @library.license = "license" diff --git a/src/noosfero-spb/software_communities/test/unit/operating_system_helper_test.rb b/src/noosfero-spb/software_communities/test/unit/operating_system_helper_test.rb index 8b2e506..9d9f033 100644 --- a/src/noosfero-spb/software_communities/test/unit/operating_system_helper_test.rb +++ b/src/noosfero-spb/software_communities/test/unit/operating_system_helper_test.rb @@ -21,44 +21,44 @@ class OperatingSystemHelperTest < ActiveSupport::TestCase should "return an empty list" do empty_list = [] - assert_equal [],OperatingSystemHelper.list_operating_system(empty_list) + assert_equal [], SoftwareCommunitiesPlugin::OperatingSystemHelper.list_operating_system(empty_list) end should "return a list with current OperatingSystems" do list_compare = [] - list_op = OperatingSystemHelper.list_operating_system(@operating_system_objects) + list_op = SoftwareCommunitiesPlugin::OperatingSystemHelper.list_operating_system(@operating_system_objects) assert_equal list_compare.class, list_op.class end should "have same information from the list passed as parameter" do - list_compare = OperatingSystemHelper.list_operating_system(@operating_system_objects) + list_compare = SoftwareCommunitiesPlugin::OperatingSystemHelper.list_operating_system(@operating_system_objects) first_operating = @operating_system_objects.first[:operating_system_name_id] assert_equal first_operating, list_compare.first.operating_system_name_id.to_s end should "return a list with the same size of the parameter" do - list_compare = OperatingSystemHelper.list_operating_system(@operating_system_objects) + list_compare = SoftwareCommunitiesPlugin::OperatingSystemHelper.list_operating_system(@operating_system_objects) assert_equal @operating_system_objects.count, list_compare.count end should "return false if list_operating_system are empty or null" do list_compare = [] - assert_equal false,OperatingSystemHelper.valid_list_operating_system?(list_compare) + assert_equal false, SoftwareCommunitiesPlugin::OperatingSystemHelper.valid_list_operating_system?(list_compare) end should "return a html text with operating system" do operating_systems = [] - operating_system = OperatingSystemName.new + operating_system = SoftwareCommunitiesPlugin::OperatingSystemName.new operating_system.name = "teste" - software_operating_system = OperatingSystem.new + software_operating_system = SoftwareCommunitiesPlugin::OperatingSystem.new software_operating_system.version = 2 software_operating_system.operating_system_name = operating_system operating_systems << software_operating_system - op_table = OperatingSystemHelper.operating_system_as_tables(operating_systems) + op_table = SoftwareCommunitiesPlugin::OperatingSystemHelper.operating_system_as_tables(operating_systems) - assert_not_nil op_table.first.call.index(OperatingSystemName.first.name) + assert_not_nil op_table.first.call.index(SoftwareCommunitiesPlugin::OperatingSystemName.first.name) end end diff --git a/src/noosfero-spb/software_communities/test/unit/operating_system_validation_test.rb b/src/noosfero-spb/software_communities/test/unit/operating_system_validation_test.rb index 1f4a42b..f3ec475 100644 --- a/src/noosfero-spb/software_communities/test/unit/operating_system_validation_test.rb +++ b/src/noosfero-spb/software_communities/test/unit/operating_system_validation_test.rb @@ -3,8 +3,8 @@ require File.dirname(__FILE__) + '/../../../../test/test_helper' class OperatingSystemValidationTest < ActiveSupport::TestCase def setup - operating_system_name = OperatingSystemName::new :name=>"Linux" - @operating_system = OperatingSystem::new :version=>"3.0" + operating_system_name = SoftwareCommunitiesPlugin::OperatingSystemName::new :name=>"Linux" + @operating_system = SoftwareCommunitiesPlugin::OperatingSystem::new :version=>"3.0" @operating_system.operating_system_name = operating_system_name @operating_system end diff --git a/src/noosfero-spb/software_communities/test/unit/repository_block_test.rb b/src/noosfero-spb/software_communities/test/unit/repository_block_test.rb index 2580e79..73c67cc 100644 --- a/src/noosfero-spb/software_communities/test/unit/repository_block_test.rb +++ b/src/noosfero-spb/software_communities/test/unit/repository_block_test.rb @@ -5,15 +5,15 @@ class RepositoryBlockTest < ActiveSupport::TestCase include PluginTestHelper should 'inherit from Block' do - assert_kind_of Block, RepositoryBlock.new + assert_kind_of Block, SoftwareCommunitiesPlugin::RepositoryBlock.new end should 'declare its default title' do - RepositoryBlock.any_instance.stubs(:profile_count).returns(0) - assert_equal Block.new.default_title, RepositoryBlock.new.default_title + SoftwareCommunitiesPlugin::RepositoryBlock.any_instance.stubs(:profile_count).returns(0) + assert_equal Block.new.default_title, SoftwareCommunitiesPlugin::RepositoryBlock.new.default_title end should 'describe itself' do - assert_not_equal Block.description, RepositoryBlock.description + assert_not_equal Block.description, SoftwareCommunitiesPlugin::RepositoryBlock.description end end diff --git a/src/noosfero-spb/software_communities/test/unit/search_catalog_block_test.rb b/src/noosfero-spb/software_communities/test/unit/search_catalog_block_test.rb index 64376ef..cc8dca4 100644 --- a/src/noosfero-spb/software_communities/test/unit/search_catalog_block_test.rb +++ b/src/noosfero-spb/software_communities/test/unit/search_catalog_block_test.rb @@ -4,16 +4,16 @@ require File.dirname(__FILE__) + '/../helpers/plugin_test_helper' class SearchCatalogBlockTest < ActiveSupport::TestCase include PluginTestHelper should 'inherit from Block' do - assert_kind_of Block, SearchCatalogBlock.new + assert_kind_of Block, SoftwareCommunitiesPlugin::SearchCatalogBlock.new end should 'declare its default title' do - SearchCatalogBlock.any_instance.stubs(:profile_count).returns(0) - assert_equal Block.new.default_title, SearchCatalogBlock.new.default_title + SoftwareCommunitiesPlugin::SearchCatalogBlock.any_instance.stubs(:profile_count).returns(0) + assert_equal Block.new.default_title, SoftwareCommunitiesPlugin::SearchCatalogBlock.new.default_title end should 'describe itself' do - assert_not_equal Block.description, SearchCatalogBlock.description + assert_not_equal Block.description, SoftwareCommunitiesPlugin::SearchCatalogBlock.description end end diff --git a/src/noosfero-spb/software_communities/test/unit/software_database_test.rb b/src/noosfero-spb/software_communities/test/unit/software_database_test.rb index c73a359..447cfc4 100644 --- a/src/noosfero-spb/software_communities/test/unit/software_database_test.rb +++ b/src/noosfero-spb/software_communities/test/unit/software_database_test.rb @@ -2,16 +2,16 @@ require File.dirname(__FILE__) + '/../../../../test/test_helper' class SoftwareDatabaseTest < ActiveSupport::TestCase def setup - DatabaseDescription.create!(name: "PostgreSQL") - @software_database = SoftwareDatabase.new( + SoftwareCommunitiesPlugin::DatabaseDescription.create!(name: "PostgreSQL") + @software_database = SoftwareCommunitiesPlugin::SoftwareDatabase.new( :version => "1.0" ) @software_database.database_description_id = 1 end def teardown - DatabaseDescription.destroy_all - SoftwareDatabase.destroy_all + SoftwareCommunitiesPlugin::DatabaseDescription.destroy_all + SoftwareCommunitiesPlugin::SoftwareDatabase.destroy_all end should "save if all informations of @software_database are filled" do diff --git a/src/noosfero-spb/software_communities/test/unit/software_helper_test.rb b/src/noosfero-spb/software_communities/test/unit/software_helper_test.rb index fc88cc4..fc98c42 100644 --- a/src/noosfero-spb/software_communities/test/unit/software_helper_test.rb +++ b/src/noosfero-spb/software_communities/test/unit/software_helper_test.rb @@ -2,19 +2,19 @@ require File.dirname(__FILE__) + '/../../../../test/test_helper' class SoftwareHelperTest < ActiveSupport::TestCase - include SoftwareHelper + include SoftwareCommunitiesPlugin::SoftwareHelper should "Create ProgrammingLanguages based on file with languages names" do - ProgrammingLanguage.delete_all + SoftwareCommunitiesPlugin::ProgrammingLanguage.delete_all PATH_TO_FILE = "plugins/software_communities/public/static/languages.txt" - SoftwareHelper.create_list_with_file(PATH_TO_FILE, ProgrammingLanguage) + SoftwareCommunitiesPlugin::SoftwareHelper.create_list_with_file(PATH_TO_FILE, SoftwareCommunitiesPlugin::ProgrammingLanguage) list = File.open(PATH_TO_FILE, "r") count = list.readlines.count list.close - assert(ProgrammingLanguage.count == count) + assert(SoftwareCommunitiesPlugin::ProgrammingLanguage.count == count) end should "return the software template specified in config.yml file" do @@ -22,9 +22,9 @@ class SoftwareHelperTest < ActiveSupport::TestCase parsed_yaml = {"software_template" => "software_template"} - SoftwareHelper.stubs(:software_template_identifier).returns("software_template") + SoftwareCommunitiesPlugin::SoftwareHelper.stubs(:software_template_identifier).returns("software_template") - software_template = SoftwareHelper.software_template + software_template = SoftwareCommunitiesPlugin::SoftwareHelper.software_template assert !software_template.blank? assert software_template.is_template end @@ -32,14 +32,14 @@ class SoftwareHelperTest < ActiveSupport::TestCase should "not return the software template if there is not software template" do parsed_yaml = {"software_template" => "software_template"} - SoftwareHelper.stubs(:software_template_identifier).returns("software_template") + SoftwareCommunitiesPlugin::SoftwareHelper.stubs(:software_template_identifier).returns("software_template") - software_template = SoftwareHelper.software_template + software_template = SoftwareCommunitiesPlugin::SoftwareHelper.software_template assert software_template.blank? template_community = Community.create!(:name => "Software", :identifier => "software_template") - software_template = SoftwareHelper.software_template + software_template = SoftwareCommunitiesPlugin::SoftwareHelper.software_template assert software_template.blank? end end diff --git a/src/noosfero-spb/software_communities/test/unit/software_info_test.rb b/src/noosfero-spb/software_communities/test/unit/software_info_test.rb index 930436c..fbfd1f2 100644 --- a/src/noosfero-spb/software_communities/test/unit/software_info_test.rb +++ b/src/noosfero-spb/software_communities/test/unit/software_info_test.rb @@ -3,7 +3,7 @@ require File.dirname(__FILE__) + '/../helpers/plugin_test_helper' class SoftwareInfoValidationTest < ActiveSupport::TestCase - include PluginTestHelper + include SoftwareCommunitiesPlugin::PluginTestHelper should "Return original license_info when license is not 'Another'" do @software_info = create_software_info("software_test") @@ -41,4 +41,4 @@ class SoftwareInfoValidationTest < ActiveSupport::TestCase assert_equal @software_info.license_info.link, another_license_link end -end \ No newline at end of file +end diff --git a/src/noosfero-spb/software_communities/test/unit/software_info_validation_test.rb b/src/noosfero-spb/software_communities/test/unit/software_info_validation_test.rb index b5324a6..6006547 100644 --- a/src/noosfero-spb/software_communities/test/unit/software_info_validation_test.rb +++ b/src/noosfero-spb/software_communities/test/unit/software_info_validation_test.rb @@ -9,29 +9,29 @@ class SoftwareInfoValidationTest < ActiveSupport::TestCase :name => 'New Software' ) - @language = ProgrammingLanguage.new(:name => 'C++') + @language = SoftwareCommunitiesPlugin::ProgrammingLanguage.new(:name => 'C++') @language.save - @software_language = SoftwareLanguage.new( + @software_language = SoftwareCommunitiesPlugin::SoftwareLanguage.new( :version => '1' ) @software_language.programming_language = @language @software_language.save - @database = DatabaseDescription.new(:name => 'Oracle') + @database = SoftwareCommunitiesPlugin::DatabaseDescription.new(:name => 'Oracle') @database.save - @software_database = SoftwareDatabase.new( + @software_database = SoftwareCommunitiesPlugin::SoftwareDatabase.new( :version => '2' ) @software_database.database_description = @database @software_database.save - @operating_system_name = OperatingSystemName.new(:name => 'Debian') + @operating_system_name = SoftwareCommunitiesPlugin::OperatingSystemName.new(:name => 'Debian') @operating_system_name.save - @operating_system = OperatingSystem.new(:version => '1.0') + @operating_system = SoftwareCommunitiesPlugin::OperatingSystem.new(:version => '1.0') @operating_system.operating_system_name = @operating_system_name @operating_system.save - @software_info = SoftwareInfo.new( + @software_info = SoftwareCommunitiesPlugin::SoftwareInfo.new( :acronym => "SFTW", :e_mag => true, :icp_brasil => true, @@ -53,13 +53,13 @@ class SoftwareInfoValidationTest < ActiveSupport::TestCase end def teardown - ProgrammingLanguage.destroy_all - SoftwareLanguage.destroy_all - DatabaseDescription.destroy_all - SoftwareDatabase.destroy_all - OperatingSystem.destroy_all - OperatingSystemName.destroy_all - SoftwareInfo.destroy_all + SoftwareCommunitiesPlugin::ProgrammingLanguage.destroy_all + SoftwareCommunitiesPlugin::SoftwareLanguage.destroy_all + SoftwareCommunitiesPlugin::DatabaseDescription.destroy_all + SoftwareCommunitiesPlugin::SoftwareDatabase.destroy_all + SoftwareCommunitiesPlugin::OperatingSystem.destroy_all + SoftwareCommunitiesPlugin::OperatingSystemName.destroy_all + SoftwareCommunitiesPlugin::SoftwareInfo.destroy_all end should 'Save SoftwareInfo if all fields are filled' do diff --git a/src/noosfero-spb/software_communities/test/unit/software_language_helper_test.rb b/src/noosfero-spb/software_communities/test/unit/software_language_helper_test.rb index 9465f91..db6211e 100644 --- a/src/noosfero-spb/software_communities/test/unit/software_language_helper_test.rb +++ b/src/noosfero-spb/software_communities/test/unit/software_language_helper_test.rb @@ -3,8 +3,8 @@ require File.dirname(__FILE__) + '/../../../../test/test_helper' class SoftwareLanguageHelperTest < ActiveSupport::TestCase def setup - pl1 = ProgrammingLanguage.create(:name => "Python") - pl2 = ProgrammingLanguage.create(:name => "Java") + pl1 = SoftwareCommunitiesPlugin::ProgrammingLanguage.create(:name => "Python") + pl2 = SoftwareCommunitiesPlugin::ProgrammingLanguage.create(:name => "Java") @software_language_objects = [ {:programming_language_id => pl1.id.to_s ,:version => "2.0"}, @@ -15,35 +15,35 @@ class SoftwareLanguageHelperTest < ActiveSupport::TestCase def teardown @software_language_objects = nil - ProgrammingLanguage.destroy_all + SoftwareCommunitiesPlugin::ProgrammingLanguage.destroy_all end should "return an empty list" do empty_list = [] - assert_equal [], SoftwareLanguageHelper.list_language(empty_list) + assert_equal [], SoftwareCommunitiesPlugin::SoftwareLanguageHelper.list_language(empty_list) end should "return a list with current software language objects" do list_compare = [] - softwares = SoftwareLanguageHelper.list_language(@software_language_objects) + softwares = SoftwareCommunitiesPlugin::SoftwareLanguageHelper.list_language(@software_language_objects) assert_equal list_compare.class, softwares.class end should "have same information from the list passed as parameter" do - list_compare = SoftwareLanguageHelper.list_language(@software_language_objects) + list_compare = SoftwareCommunitiesPlugin::SoftwareLanguageHelper.list_language(@software_language_objects) lang_id = @software_language_objects.first[:programming_language_id].to_i assert_equal lang_id, list_compare.first.programming_language_id end should "return a list with the same size of the parameter" do - list_compare = SoftwareLanguageHelper.list_language(@software_language_objects) + list_compare = SoftwareCommunitiesPlugin::SoftwareLanguageHelper.list_language(@software_language_objects) assert_equal @software_language_objects.count, list_compare.count end should "return false if list_language are empty or null" do list_compare = [] - assert_equal false,SoftwareLanguageHelper.valid_list_language?(list_compare) + assert_equal false, SoftwareCommunitiesPlugin::SoftwareLanguageHelper.valid_list_language?(list_compare) end should "remove invalid tables from the list" do @@ -53,7 +53,7 @@ class SoftwareLanguageHelperTest < ActiveSupport::TestCase }) software_language_objects_length = @software_language_objects.count - list_compare = SoftwareLanguageHelper.list_language(@software_language_objects) + list_compare = SoftwareCommunitiesPlugin::SoftwareLanguageHelper.list_language(@software_language_objects) assert_equal software_language_objects_length-1, list_compare.count end diff --git a/src/noosfero-spb/software_communities/test/unit/software_language_validation.rb b/src/noosfero-spb/software_communities/test/unit/software_language_validation.rb index 8a1b21d..107b6af 100644 --- a/src/noosfero-spb/software_communities/test/unit/software_language_validation.rb +++ b/src/noosfero-spb/software_communities/test/unit/software_language_validation.rb @@ -9,7 +9,7 @@ class SoftwareLanguageValidationTest < ActiveSupport::TestCase def teardown @software_info = nil - SoftwareInfo.destroy_all + SoftwareCommunitiesPlugin::SoftwareInfo.destroy_all end should "Save SoftwareLanguage if version and prog_language are filled" do @@ -38,15 +38,15 @@ class SoftwareLanguageValidationTest < ActiveSupport::TestCase private def create_software_language - software_language = SoftwareLanguage.new + software_language = SoftwareCommunitiesPlugin::SoftwareLanguage.new software_language.software_info = @software_info - software_language.programming_language = ProgrammingLanguage.last + software_language.programming_language = SoftwareCommunitiesPlugin::ProgrammingLanguage.last software_language.version = "version" software_language end def create_software_info - software_info = SoftwareInfo.new + software_info = SoftwareCommunitiesPlugin::SoftwareInfo.new software_info.community_id = fast_create(Community).id software_info.community.name = 'Noosfero' software_info.e_mag = true @@ -61,9 +61,9 @@ class SoftwareLanguageValidationTest < ActiveSupport::TestCase end def create_programming_language - ProgrammingLanguage.create(:name=>"C") - ProgrammingLanguage.create(:name=>"C++") - ProgrammingLanguage.create(:name=>"Ruby") - ProgrammingLanguage.create(:name=>"Python") + SoftwareCommunitiesPlugin::ProgrammingLanguage.create(:name=>"C") + SoftwareCommunitiesPlugin::ProgrammingLanguage.create(:name=>"C++") + SoftwareCommunitiesPlugin::ProgrammingLanguage.create(:name=>"Ruby") + SoftwareCommunitiesPlugin::ProgrammingLanguage.create(:name=>"Python") end end diff --git a/src/noosfero-spb/software_communities/test/unit/software_license_info_test.rb b/src/noosfero-spb/software_communities/test/unit/software_license_info_test.rb index 81ab2ee..fc1929f 100644 --- a/src/noosfero-spb/software_communities/test/unit/software_license_info_test.rb +++ b/src/noosfero-spb/software_communities/test/unit/software_license_info_test.rb @@ -3,7 +3,7 @@ require File.dirname(__FILE__) + '/../../../../test/test_helper' class SoftwareDatabaseTest < ActiveSupport::TestCase should "save if all informations are filled" do - @software_license_info = LicenseInfo.create( + @software_license_info = SoftwareCommunitiesPlugin::LicenseInfo.create( :version => "GPL", :link => "www.gpl2.com" ) @@ -11,7 +11,7 @@ class SoftwareDatabaseTest < ActiveSupport::TestCase end should "not save if license info version is empty" do - @software_license_info = LicenseInfo.create( + @software_license_info = SoftwareCommunitiesPlugin::LicenseInfo.create( :version => "GPL", :link => "www.gpl2.com" ) @@ -20,7 +20,7 @@ class SoftwareDatabaseTest < ActiveSupport::TestCase end should "save if link is empty" do - @software_license_info = LicenseInfo.create( + @software_license_info = SoftwareCommunitiesPlugin::LicenseInfo.create( :version => "GPL", :link => "www.gpl2.com") @software_license_info.link = nil diff --git a/src/noosfero-spb/software_communities/test/unit/software_registration_test.rb b/src/noosfero-spb/software_communities/test/unit/software_registration_test.rb index 397adf7..753d20d 100644 --- a/src/noosfero-spb/software_communities/test/unit/software_registration_test.rb +++ b/src/noosfero-spb/software_communities/test/unit/software_registration_test.rb @@ -9,14 +9,14 @@ class SoftwareRegistrationTest < ActiveSupport::TestCase def teardown Community.destroy_all - SoftwareInfo.destroy_all + SoftwareCommunitiesPlugin::SoftwareInfo.destroy_all Task.destroy_all end should 'include software registration task if is admin' do person = create_user('molly').person @environment.add_admin(person) - task = CreateSoftware.create!( + task = SoftwareCommunitiesPlugin::CreateSoftware.create!( :name => "Teste One", :requestor => person, :environment => @environment @@ -27,16 +27,16 @@ class SoftwareRegistrationTest < ActiveSupport::TestCase should 'create software when admin accept software create task' do person = create_user('Pedro').person @environment.add_admin(person) - task = CreateSoftware.create!( + task = SoftwareCommunitiesPlugin::CreateSoftware.create!( :name => "Teste Two", :requestor => person, :environment => @environment, :finality => "something" ) - software_count = SoftwareInfo.count + software_count = SoftwareCommunitiesPlugin::SoftwareInfo.count task.finish - assert_equal software_count+1, SoftwareInfo.count + assert_equal software_count+1, SoftwareCommunitiesPlugin::SoftwareInfo.count end end diff --git a/src/noosfero-spb/software_communities/test/unit/software_tab_data_block_test.rb b/src/noosfero-spb/software_communities/test/unit/software_tab_data_block_test.rb index aad8c8c..0601430 100644 --- a/src/noosfero-spb/software_communities/test/unit/software_tab_data_block_test.rb +++ b/src/noosfero-spb/software_communities/test/unit/software_tab_data_block_test.rb @@ -2,7 +2,7 @@ require File.dirname(__FILE__) + '/../../../../test/test_helper' require File.dirname(__FILE__) + '/../helpers/plugin_test_helper' class SoftwareTabDataBlockTest < ActiveSupport::TestCase - include PluginTestHelper + include SoftwareCommunitiesPlugin::PluginTestHelper def setup @software_info = create_software_info("A new Software") @@ -14,15 +14,15 @@ class SoftwareTabDataBlockTest < ActiveSupport::TestCase @soft_community.blogs << Blog.new(:name=>"Second blog") @soft_community.save! - SoftwareTabDataBlock.any_instance.stubs(:owner).returns(@soft_community) + SoftwareCommunitiesPlugin::SoftwareTabDataBlock.any_instance.stubs(:owner).returns(@soft_community) end should "get its owner blogs" do - assert_equal @soft_community.blogs, SoftwareTabDataBlock.new.blogs + assert_equal @soft_community.blogs, SoftwareCommunitiesPlugin::SoftwareTabDataBlock.new.blogs end should "actual_blog get the first blog if it is not defined" do - assert_equal @soft_community.blogs.first, SoftwareTabDataBlock.new.actual_blog + assert_equal @soft_community.blogs.first, SoftwareCommunitiesPlugin::SoftwareTabDataBlock.new.actual_blog end should "actual_blog get the defined community blog" do @@ -46,13 +46,13 @@ class SoftwareTabDataBlockTest < ActiveSupport::TestCase soft_tab_data = create_software_tab_data_block(last_blog) craete_sample_posts(last_blog, 6) - assert_equal SoftwareTabDataBlock::TOTAL_POSTS_DYSPLAYED, soft_tab_data.posts.count + assert_equal SoftwareCommunitiesPlugin::SoftwareTabDataBlock::TOTAL_POSTS_DYSPLAYED, soft_tab_data.posts.count end private def create_software_tab_data_block blog - soft_tab_data = SoftwareTabDataBlock.new + soft_tab_data = SoftwareCommunitiesPlugin::SoftwareTabDataBlock.new soft_tab_data.displayed_blog = blog.id soft_tab_data end diff --git a/src/noosfero-spb/software_communities/test/unit/softwares_block_test.rb b/src/noosfero-spb/software_communities/test/unit/softwares_block_test.rb index 44b5064..c109e83 100644 --- a/src/noosfero-spb/software_communities/test/unit/softwares_block_test.rb +++ b/src/noosfero-spb/software_communities/test/unit/softwares_block_test.rb @@ -2,22 +2,22 @@ require File.dirname(__FILE__) + '/../../../../test/test_helper' require File.dirname(__FILE__) + '/../helpers/plugin_test_helper' class SoftwaresBlockTest < ActiveSupport::TestCase - include PluginTestHelper + include SoftwareCommunitiesPlugin::PluginTestHelper should 'inherit from ProfileListBlock' do - assert_kind_of ProfileListBlock, SoftwaresBlock.new + assert_kind_of ProfileListBlock, SoftwareCommunitiesPlugin::SoftwaresBlock.new end should 'declare its default title' do - SoftwaresBlock.any_instance.stubs(:profile_count).returns(0) - assert_not_equal ProfileListBlock.new.default_title, SoftwaresBlock.new.default_title + SoftwareCommunitiesPlugin::SoftwaresBlock.any_instance.stubs(:profile_count).returns(0) + assert_not_equal ProfileListBlock.new.default_title, SoftwareCommunitiesPlugin::SoftwaresBlock.new.default_title end should 'describe itself' do - assert_not_equal ProfileListBlock.description, SoftwaresBlock.description + assert_not_equal ProfileListBlock.description, SoftwareCommunitiesPlugin::SoftwaresBlock.description end should 'give empty footer on unsupported owner type' do - block = SoftwaresBlock.new + block = SoftwareCommunitiesPlugin::SoftwaresBlock.new block.expects(:owner).returns(1) assert_equal '', block.footer end @@ -34,7 +34,7 @@ class SoftwaresBlockTest < ActiveSupport::TestCase software_info = create_software_info("new software") software_info.community.add_member(user) - block = SoftwaresBlock.new + block = SoftwareCommunitiesPlugin::SoftwaresBlock.new block.expects(:owner).at_least_once.returns(user) assert_equivalent [software_info.community], block.profiles -- libgit2 0.21.2