From 99ece19bd5eb70e16c0240d45249839cfd4c7ed9 Mon Sep 17 00:00:00 2001 From: Gabriela Navarro Date: Tue, 23 Sep 2014 14:25:59 +0000 Subject: [PATCH] Fix functionals tests for new software --- test/functional/account_controller_test.rb | 4 ++-- test/functional/mpog_software_plugin_myprofile_controller_test.rb | 5 ++--- test/functional/software_test_helper.rb | 39 ++++++++++++++++++++++++++++++++++++++- 3 files changed, 42 insertions(+), 6 deletions(-) diff --git a/test/functional/account_controller_test.rb b/test/functional/account_controller_test.rb index 81b447f..8f8a7d7 100644 --- a/test/functional/account_controller_test.rb +++ b/test/functional/account_controller_test.rb @@ -45,7 +45,6 @@ class AccountControllerTest < ActionController::TestCase @second_profile_data_info = { :name=>"Um outro usuario", - :area_interest=>"uma area ai" } disable_signup_bot_check end @@ -129,7 +128,8 @@ class AccountControllerTest < ActionController::TestCase post :signup, :user => @user_info, :profile_data => @profile_data_info assert !assigns(:user).save, "This should not have been saved." - + end + should "user can register without secondary_email" do @user_info[:secondary_email] = "" diff --git a/test/functional/mpog_software_plugin_myprofile_controller_test.rb b/test/functional/mpog_software_plugin_myprofile_controller_test.rb index a3698a6..a70f086 100644 --- a/test/functional/mpog_software_plugin_myprofile_controller_test.rb +++ b/test/functional/mpog_software_plugin_myprofile_controller_test.rb @@ -65,9 +65,8 @@ class MpogSoftwarePluginMyprofileControllerTest < ActionController::TestCase fields = software_fields post :new_software, :profile => person.identifier, :community => fields[6], :license_info => fields[5], :software_info => fields[0], :library => fields[1], :database => fields[3], - :language => fields[2], :operating_system=> fields[4] - - assert_equal SoftwareInfo.last.name, "Debian" + :language => fields[2], :operating_system=> fields[4],:software_categories => fields[7] + assert_equal SoftwareInfo.last.community.name, "Debian" end diff --git a/test/functional/software_test_helper.rb b/test/functional/software_test_helper.rb index 7cb6ba9..c48a651 100644 --- a/test/functional/software_test_helper.rb +++ b/test/functional/software_test_helper.rb @@ -52,6 +52,16 @@ module SoftwareTestHelper license_info end + def create_categories categories_hash + software_categories = SoftwareCategories.new + + categories_hash.each do |k,v| + software_categories[k] = v + end + software_categories.save + software_categories + end + def create_software fields software = SoftwareInfo.new @@ -63,6 +73,7 @@ module SoftwareTestHelper operating_system_hash = fields[4] license_system_hash = fields[5] community_hash = fields[6] + categories_hash = fields[7] software_hash.each do |k,v| software[k] = v @@ -79,6 +90,7 @@ module SoftwareTestHelper software.operating_systems << create_operating_system(operating_system_hash) software.license_info_id = license_system_hash software.libraries << create_library(library_hash) + software.software_categories = create_categories(categories_hash) software end @@ -132,6 +144,30 @@ module SoftwareTestHelper fields['operating_platform'] = 'operating_plataform_test' fields['demonstration_url'] = 'test' + fields_categories = {} + fields_categories["administration"] = true + fields_categories["agriculture"] = "1" + fields_categories["business_and_services"] = "1" + fields_categories["communication"] = "1" + fields_categories["culture"] = "1" + fields_categories["national_defense"] = "1" + fields_categories["economy_and_finances"] = "1" + fields_categories["education"] = "1" + fields_categories["energy"] = "1" + fields_categories["sports"] = "1" + fields_categories["habitation"] = "1" + fields_categories["industry"] = "1" + fields_categories["environment"] = "1" + fields_categories["research_and_development"] = "1" + fields_categories["social_security"] = "1" + fields_categories["social_protection"] = "1" + fields_categories["sanitation"] = "1" + fields_categories["health"] = "1" + fields_categories["security_public_order"] = "1" + fields_categories["work"] = "1" + fields_categories["transportation"] = "1" + fields_categories["urbanism"] = "1" + hash_list = [] hash_list << fields hash_list << list_library @@ -140,6 +176,7 @@ module SoftwareTestHelper hash_list << list_operating_system hash_list << fields_license hash_list << fields_community + hash_list << fields_categories hash_list end -end \ No newline at end of file +end -- libgit2 0.21.2