diff --git a/controllers/mpog_software_plugin_myprofile_controller.rb b/controllers/mpog_software_plugin_myprofile_controller.rb index feed657..4e62d33 100644 --- a/controllers/mpog_software_plugin_myprofile_controller.rb +++ b/controllers/mpog_software_plugin_myprofile_controller.rb @@ -22,7 +22,7 @@ class MpogSoftwarePluginMyprofileController < MyProfileController @license_info = if params[:license_info].nil? LicenseInfo::new else - LicenseInfo.find(:first, :conditions=>"id = #{params[:license_info][:version]}") + LicenseInfo.find(:first, :conditions =>["version = ?","#{params[:license_info][:version]}"]) end if not @list_libraries.nil? diff --git a/test/functional/mpog_software_plugin_myprofile_controller_test.rb b/test/functional/mpog_software_plugin_myprofile_controller_test.rb index b5ca427..269ea62 100644 --- a/test/functional/mpog_software_plugin_myprofile_controller_test.rb +++ b/test/functional/mpog_software_plugin_myprofile_controller_test.rb @@ -1,6 +1,5 @@ require File.dirname(__FILE__) + '/../../../../test/test_helper' -require File.dirname(__FILE__) + -'/../../controllers/mark_comment_as_read_plugin_profile_controller' +require File.dirname(__FILE__) + '/../../controllers/mpog_software_plugin_myprofile_controller' class MpogSoftwarePluginMyprofileController; def rescue_action(e) raise e end; end @@ -10,10 +9,9 @@ class MpogSoftwarePluginMyprofileControllerTest < ActionController::TestCase @controller = MpogSoftwarePluginMyprofileController.new @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new - # @organization = Community.create!(:name => 'My Software', :identifier => - # 'my-software') @person = create_user('person').person - #@organization.add_admin(@person) + LicenseInfo.create(:version=>"CC-GPL-V2", +:link=>"http://creativecommons.org/licenses/GPL/2.0/legalcode.pt") login_as(@person.user.login) e = Environment.default e.enable_plugin('MpogSoftwarePlugin') @@ -22,9 +20,38 @@ class MpogSoftwarePluginMyprofileControllerTest < ActionController::TestCase attr_accessor :person - should 'search new offerers while creating a new software' do - end + should 'create new_software' do + community = { + :name => 'debian' + } + software_info = { + :e_mag => true , + :icp_brasil => false, + :intern => false , + :e_ping => false , + :e_arq => false, + :name =>'test', + :operating_platform =>'test', + :demonstration_url => 'test', + :acronym => 'test', + :objectives => 'test', + :features => 'test' + } + library = [{ + :name => 'test', + :version => 'test', + :license=> 'test' + },{}] + database = [{ + :name => 'mysql' + },{}] + language = [{ + :version => 'test', + :operating_system => 'test' + },{}] - should 'search new offerers while edting a new software' do + license_info = {:version => "CC-GPL-V2",:link => "http://creativecommons.org/licenses/GPL/2.0/legalcode.pt"} + post :new_software, :profile => person.identifier, :community => community, :license_info => license_info, + :software_info => software_info, :library => library, :database => database, :language => language end end -- libgit2 0.21.2