From cdc4afefd801365b24f92ded36d7ca8ad4a5bd31 Mon Sep 17 00:00:00 2001 From: Luciano Date: Thu, 11 Dec 2014 17:25:51 -0200 Subject: [PATCH] Remove trailing whitespace --- lib/categories_software_block.rb | 3 ++- lib/database_helper.rb | 94 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------- lib/ext/community.rb | 4 +++- lib/ext/profile_helper.rb | 9 +++++++-- lib/ext/search_controller.rb | 6 ++---- lib/ext/user.rb | 36 +++++++++++++++++++++++++++--------- lib/governmental_power.rb | 5 ++++- lib/juridical_nature.rb | 5 ++++- lib/library_helper.rb | 48 +++++++++++++++++++++++++++++++++++++----------- lib/license_helper.rb | 2 +- lib/mpog_software_plugin.rb | 149 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------ lib/operating_system_helper.rb | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++-------------- lib/public_institution.rb | 15 ++++++++++++--- lib/software_database.rb | 18 +++++++++++++++--- lib/software_info.rb | 47 +++++++++++++++++++++++++++++++++++++---------- lib/software_language.rb | 13 +++++++++++-- test/functional/mpog_software_plugin_myprofile_controller_test.rb | 135 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------- test/functional/profile_editor_controller_test.rb | 38 ++++++++++++++++++++++++++++++++++---- test/functional/search_controller_test.rb | 148 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------------------------------- test/helpers/plugin_test_helper.rb | 17 +++++++++++++++-- 20 files changed, 657 insertions(+), 200 deletions(-) diff --git a/lib/categories_software_block.rb b/lib/categories_software_block.rb index 017ca9d..5bcd1a5 100644 --- a/lib/categories_software_block.rb +++ b/lib/categories_software_block.rb @@ -9,7 +9,8 @@ class CategoriesSoftwareBlock < Block end def help - _('This block displays the categories and the amount of softwares for each category.') + _('This block displays the categories and the amount of softwares for + each category.') end def content(args={}) diff --git a/lib/database_helper.rb b/lib/database_helper.rb index 6c4aac3..48e09f8 100644 --- a/lib/database_helper.rb +++ b/lib/database_helper.rb @@ -3,11 +3,12 @@ module DatabaseHelper def self.valid_database? database return false if SoftwareHelper.all_table_is_empty?(database) - database_description_id_list = DatabaseDescription.select(:id).collect {|dd| dd.id } + database_description_id_list = DatabaseDescription.select(:id). + collect {|dd| dd.id} - return false unless database_description_id_list.include?(database[:database_description_id].to_i) - - true + return database_description_id_list.include?( + database[:database_description_id].to_i + ) end def self.list_database new_databases @@ -17,7 +18,10 @@ module DatabaseHelper new_databases.each do |new_database| if valid_database? new_database database = SoftwareDatabase.new - database.database_description_id = new_database[:database_description_id] + + database.database_description_id = + new_database[:database_description_id] + database.version = new_database[:version] database.operating_system = new_database[:operating_system] list_databases << database @@ -46,7 +50,9 @@ module DatabaseHelper ApplicationHelper ) - return database_html_structure({:database_description_id => "", :version => "", :operating_system => ""}) if list_databases.nil? + return database_html_structure( + {:database_description_id => "", :version => "", :operating_system => ""} + ) if list_databases.nil? lambdas_list = [] @@ -61,30 +67,78 @@ module DatabaseHelper database_name = if database_data[:database_description_id].blank? "" else - DatabaseDescription.find(database_data[:database_description_id], :select=>"name").name + DatabaseDescription.find( + database_data[:database_description_id], + :select=>"name" + ).name end Proc::new do - content_tag('table', - content_tag('tr', + content_tag( + 'table', + content_tag( + 'tr', content_tag('td', label_tag(_("database Name: ")))+ - content_tag('td', - text_field_tag("database_autocomplete", database_name, :class=>"database_autocomplete", :placeholder=>_("Autocomplete field, type something")) + - content_tag('div', _("Pick an item on the list"), :class=>"autocomplete_validation_message hide-field") + content_tag( + 'td', + text_field_tag( + "database_autocomplete", + database_name, + :class=>"database_autocomplete", + :placeholder=>_("Autocomplete field, type something") + ) + + content_tag( + 'div', + _("Pick an item on the list"), + :class=>"autocomplete_validation_message hide-field" + ) )+ - content_tag('td', hidden_field_tag("database[][database_description_id]", database_data[:database_description_id], :class=>"database_description_id", data:{label:database_name})) + content_tag( + 'td', + hidden_field_tag( + "database[][database_description_id]", + database_data[:database_description_id], + :class => "database_description_id", + :data => {:label => database_name} + ) + ) )+ - content_tag('tr', + content_tag( + 'tr', content_tag('td', label_tag(_("Version")))+ - content_tag('td', text_field_tag("database[][version]", database_data[:version], :maxlength=>"20"))+ + content_tag( + 'td', + text_field_tag( + "database[][version]", + database_data[:version], + :maxlength=>"20" + ) + )+ content_tag('td') )+ - content_tag('tr', - content_tag('td', label_tag(_("Operating System")))+ - content_tag('td', text_field_tag("database[][operating_system]", database_data[:operating_system], :maxlength=>"20"))+ - content_tag('td', button_without_text(:delete, _('Delete'), "#" , :class=>"delete-dynamic-table"), :align => 'right') + content_tag( + 'tr', + content_tag('td', label_tag(_("Operating System")))+ + content_tag( + 'td', + text_field_tag( + "database[][operating_system]", + database_data[:operating_system], + :maxlength=>"20" + ) + )+ + content_tag( + 'td', + button_without_text( + :delete, + _('Delete'), + "#" , + :class=>"delete-dynamic-table" + ), + :align => 'right' + ) ), :class => 'dynamic-table database-table' ) end @@ -93,4 +147,4 @@ module DatabaseHelper def self.add_dynamic_table database_as_tables(nil).call end -end +end \ No newline at end of file diff --git a/lib/ext/community.rb b/lib/ext/community.rb index e9c9c4d..073ce4a 100644 --- a/lib/ext/community.rb +++ b/lib/ext/community.rb @@ -10,7 +10,9 @@ class Community def self.create_after_moderation(requestor, attributes = {}) community = Community.new(attributes) - if community.environment.enabled?('admin_must_approve_new_communities') and !community.environment.admins.include?(requestor) + if community.environment.enabled?('admin_must_approve_new_communities') && + !community.environment.admins.include?(requestor) + cc = CreateCommunity.create(attributes.merge(:requestor => requestor)) else community = Community.create(attributes) diff --git a/lib/ext/profile_helper.rb b/lib/ext/profile_helper.rb index c5a7a56..7268d4b 100644 --- a/lib/ext/profile_helper.rb +++ b/lib/ext/profile_helper.rb @@ -1,7 +1,8 @@ require_dependency 'profile_helper' module ProfileHelper - PERSON_CATEGORIES[:mpog_profile_information] = [:secondary_email, :institutions] + PERSON_CATEGORIES[:mpog_profile_information] = [:secondary_email, + :institutions] def display_mpog_field(title, profile, field, force = false) unless force || profile.may_display_field_to?(field, user) @@ -12,7 +13,11 @@ module ProfileHelper if block_given? value = yield(value) end - content_tag('tr', content_tag('td', title, :class => 'field-name') + content_tag('td', value)) + content_tag( + 'tr', + content_tag('td', title, :class => 'field-name') + + content_tag('td', value) + ) else '' end diff --git a/lib/ext/search_controller.rb b/lib/ext/search_controller.rb index 53f8683..819c0f5 100644 --- a/lib/ext/search_controller.rb +++ b/lib/ext/search_controller.rb @@ -4,7 +4,7 @@ class SearchController def communities results = filter_communities_list do |community| - !community.software? && !community.institution? + !community.software? and !community.institution? end results = results.paginate(:per_page => 24, :page => params[:page]) @searches[@asset] = {:results => results} @@ -55,9 +55,7 @@ class SearchController filtered_communities_list = [] unfiltered_software_infos_list.each do |software| - unless software.community.is_template? - filtered_communities_list << software.community - end + filtered_communities_list << software.community end if not params[:filter].blank? diff --git a/lib/ext/user.rb b/lib/ext/user.rb index fb608fc..70afd05 100644 --- a/lib/ext/user.rb +++ b/lib/ext/user.rb @@ -12,18 +12,27 @@ class User } def email_different_secondary? - self.errors.add(:base, _("Email must be different from secondary email.")) if self.email == self.secondary_email + self.errors.add( + :base, + _("Email must be different from secondary email.") + ) if self.email == self.secondary_email end def email_has_already_been_used? - user_already_saved = User.find(:first, :conditions=>["email = ?", self.email]) + user_already_saved = User.find(:first, + :conditions => ["email = ?", self.email]) if user_already_saved.nil? - primary_email_hasnt_been_used = User.primary_or_secondary_email_already_used?(self.email).empty? + primary_email_hasnt_been_used = + User.primary_or_secondary_email_already_used?(self.email).empty? + if !self.secondary_email.nil? and self.secondary_email.empty? self.secondary_email = nil end - secondary_email_hasnt_been_used = User.primary_or_secondary_email_already_used?(self.secondary_email).empty? + + secondary_email_hasnt_been_used = + User.primary_or_secondary_email_already_used?(self.secondary_email). + empty? if !primary_email_hasnt_been_used or !secondary_email_hasnt_been_used self.errors.add(:base, _("E-mail or secondary e-mail already taken.")) @@ -34,7 +43,10 @@ class User def secondary_email_format if !self.secondary_email.nil? and self.secondary_email.length > 0 test = /\A[^@]+@([^@\.]+\.)+[^@\.]+\z/ - self.errors.add(:base, _("Invalid secondary email format.")) unless test.match(self.secondary_email) + + unless test.match(self.secondary_email) + self.errors.add(:base, _("Invalid secondary email format.")) + end end end @@ -49,12 +61,18 @@ class User unless primary_email_has_gov_suffix if !self.secondary_email.nil? and self.secondary_email.length > 0 - secondary_email_has_gov_suffix = true if test.match(self.secondary_email) + secondary_email_has_gov_suffix = !!test.match(self.secondary_email) end - self.errors.add(:base, _("The governamental email must be the primary one.")) if secondary_email_has_gov_suffix + self.errors.add( + :base, + _("The governamental email must be the primary one.") + ) if secondary_email_has_gov_suffix end - self.errors.add(:base, _("Institution is obligatory if user has a government email.")) if primary_email_has_gov_suffix and self.institutions.blank? + self.errors.add( + :base, + _("Institution is obligatory if user has a government email.") + ) if primary_email_has_gov_suffix and self.institutions.blank? end -end +end \ No newline at end of file diff --git a/lib/governmental_power.rb b/lib/governmental_power.rb index 992fa7f..cb7ca36 100644 --- a/lib/governmental_power.rb +++ b/lib/governmental_power.rb @@ -5,6 +5,9 @@ class GovernmentalPower < ActiveRecord::Base has_many :institutions def public_institutions - Institution.where(:type=>"PublicInstitution", :governmental_power_id=>self.id) + Institution.where( + :type=>"PublicInstitution", + :governmental_power_id=>self.id + ) end end diff --git a/lib/juridical_nature.rb b/lib/juridical_nature.rb index 8f3b615..11494c1 100644 --- a/lib/juridical_nature.rb +++ b/lib/juridical_nature.rb @@ -7,6 +7,9 @@ class JuridicalNature < ActiveRecord::Base validates_uniqueness_of :name def public_institutions - Institution.where(:type=>"PublicInstitution", :governmental_power_id=>self.id) + Institution.where( + :type=>"PublicInstitution", + :governmental_power_id=>self.id + ) end end diff --git a/lib/library_helper.rb b/lib/library_helper.rb index 1a4bf01..88bd1de 100644 --- a/lib/library_helper.rb +++ b/lib/library_helper.rb @@ -34,7 +34,13 @@ module LibraryHelper ApplicationHelper ) - return library_html_structure({:name=>"", :version=>"", :license=>""}) if list_libraries.nil? + return library_html_structure( + { + :name=>"", + :version=>"", + :license=>"" + } + ) if list_libraries.nil? lambdas_list = [] @@ -47,27 +53,47 @@ module LibraryHelper def self.library_html_structure library_data Proc::new do - content_tag('table', - content_tag('tr', + content_tag( + 'table', + content_tag( + 'tr', content_tag('td', label_tag(_("Name")))+ - content_tag('td', text_field_tag("library[][name]", library_data[:name]))+ + content_tag( + 'td', + text_field_tag("library[][name]", library_data[:name]) + )+ content_tag('td') )+ - content_tag('tr', + content_tag( + 'tr', content_tag('td', label_tag(_("Version")))+ - content_tag('td', text_field_tag("library[][version]", library_data[:version]))+ + content_tag( + 'td', + text_field_tag("library[][version]", library_data[:version]) + )+ content_tag('td') )+ - content_tag('tr', + content_tag( + 'tr', content_tag('td', label_tag(_("License")))+ - content_tag('td', text_field_tag("library[][license]", library_data[:license])) + - content_tag('td', - button_without_text(:delete, _('Delete'), "#" , :class=>"delete-dynamic-table"), + content_tag( + 'td', + text_field_tag("library[][license]", library_data[:license])) + + content_tag( + 'td', + button_without_text( + :delete, + _('Delete'), + "#" , + :class=>"delete-dynamic-table" + ), :align => 'right' ) - ), :class => 'dynamic-table library-table' + ), + + :class => 'dynamic-table library-table' ) end end diff --git a/lib/license_helper.rb b/lib/license_helper.rb index 000c551..af390cb 100644 --- a/lib/license_helper.rb +++ b/lib/license_helper.rb @@ -2,4 +2,4 @@ module LicenseHelper def self.getListLicenses LicenseInfo.all end -end +end \ No newline at end of file diff --git a/lib/mpog_software_plugin.rb b/lib/mpog_software_plugin.rb index 9e96e48..159ca65 100644 --- a/lib/mpog_software_plugin.rb +++ b/lib/mpog_software_plugin.rb @@ -21,7 +21,9 @@ class MpogSoftwarePlugin < Noosfero::Plugin def profile_editor_extras if context.profile.person? expanded_template('person_editor_extras.html.erb') - elsif context.profile.respond_to? :software_info and !context.profile.software_info.nil? + elsif context.profile.respond_to? :software_info && + !context.profile.software_info.nil? + if context.profile.software_info.first_edit? context.profile.software_info.first_edit = false context.profile.software_info.save! @@ -55,7 +57,10 @@ class MpogSoftwarePlugin < Noosfero::Plugin if context.params.has_key?(:operating_system) operating_system_transaction end - if context.params.has_key?(:institution) || context.params.has_key?(:governmental_power) || context.params.has_key?(:governmental_sphere) + if context.params.has_key?(:institution) || + context.params.has_key?(:governmental_power) || + context.params.has_key?(:governmental_sphere) + institution_transaction end @@ -77,8 +82,10 @@ class MpogSoftwarePlugin < Noosfero::Plugin unless is_admin institution = profile.user.institutions - if !params[:institution].blank? and !params[:institution][:sisp].nil? - params[:institution][:sisp] = institution.sisp if params[:institution][:sisp] != institution.sisp + if !params[:institution].blank? && !params[:institution][:sisp].nil? + if params[:institution][:sisp] != institution.sisp + params[:institution][:sisp] = institution.sisp + end end end end @@ -109,12 +116,32 @@ class MpogSoftwarePlugin < Noosfero::Plugin def control_panel_buttons if context.profile.software? - return { :title => _("Software Info"), :icon => "edit-profile-group control-panel-software-link", :url => {:controller => "mpog_software_plugin_myprofile", :action => "edit_software"} } + return { + :title => _("Software Info"), + :icon => "edit-profile-group control-panel-software-link", + :url => { + :controller => "mpog_software_plugin_myprofile", + :action => "edit_software" + } + } elsif context.profile.person? - return { :title => _("Create a new software"), :icon => "design-editor", :url => {:controller => "mpog_software_plugin_myprofile", :action => "new_software"} } + return { + :title => _("Create a new software"), + :icon => "design-editor", + :url => { + :controller => "mpog_software_plugin_myprofile", + :action => "new_software" + } + } return nil elsif context.profile.institution? - return { :title => _("Institution Info"), :icon => "edit-profile-group control-panel-instituton-link", :url => {:controller => "mpog_software_plugin_myprofile", :action => "edit_institution"} } + return { + :title => _("Institution Info"), + :icon => "edit-profile-group control-panel-instituton-link", + :url => { + :controller => "mpog_software_plugin_myprofile", + :action => "edit_institution"} + } end end @@ -152,7 +179,12 @@ class MpogSoftwarePlugin < Noosfero::Plugin def add_new_organization_buttons Proc::new do - button(:add, _('Create a new software'), :controller => 'mpog_software_plugin_myprofile', :action => 'new_software') + button( + :add, + _('Create a new software'), + :controller => 'mpog_software_plugin_myprofile', + :action => 'new_software' + ) end end @@ -162,7 +194,8 @@ class MpogSoftwarePlugin < Noosfero::Plugin end def profile_blocks_extra_content - return if context.session[:user].nil? or context.session[:hide_incomplete_percentage] == true + return if context.session[:user].nil? or + !!context.session[:hide_incomplete_percentage] person = Person.where(:user_id=>context.session[:user]).first @@ -176,10 +209,32 @@ class MpogSoftwarePlugin < Noosfero::Plugin end end + def custom_user_registration_attributes user + unless context.params[:user][:institution_ids].nil? + context.params[:user][:institution_ids].delete("") + + context.params[:user][:institution_ids].each do |institution_id| + institution = Institution.find institution_id + user.institutions << institution + + if institution.community.admins.blank? + institution.community.add_admin(user.person) + end + end + end + user.save unless user.institution_ids.empty? + + user.institutions.each do |institution| + community = institution.community + community.add_member user.person + end + end + def calc_percentage_registration person required_list = profile_required_list empty_fields = profile_required_empty_list person - count = required_list[:person_fields].count + required_list[:user_fields].count + count = required_list[:person_fields].count + + required_list[:user_fields].count percentege = 100 - ((empty_fields.count*100)/count) person.percentage_incomplete = percentege person.save(validate: false) @@ -187,7 +242,15 @@ class MpogSoftwarePlugin < Noosfero::Plugin end def admin_panel_links - [{:title => _('Create Institution'), :url => {:controller => 'mpog_software_plugin', :action => 'create_institution_admin'}}] + [ + { + :title => _('Create Institution'), + :url => { + :controller => 'mpog_software_plugin', + :action => 'create_institution_admin' + } + } + ] end protected @@ -201,7 +264,18 @@ class MpogSoftwarePlugin < Noosfero::Plugin def profile_required_list fields = Hash.new - fields[:person_fields] = ["cell_phone","contact_phone","comercial_phone","country","city","state","organization_website", "image", "identifier", "name"] + fields[:person_fields] = [ + "cell_phone", + "contact_phone", + "comercial_phone", + "country", + "city", + "state", + "organization_website", + "image", + "identifier", + "name" + ] fields[:user_fields] = ["secondary_email", "email"] fields end @@ -225,10 +299,15 @@ class MpogSoftwarePlugin < Noosfero::Plugin def operating_system_transaction OperatingSystem.transaction do - list_operating = OperatingSystemHelper.list_operating_system(context.params[:operating_system]) + list_operating = OperatingSystemHelper.list_operating_system( + context.params[:operating_system] + ) if OperatingSystemHelper.valid_list_operating_system?(list_operating) - OperatingSystem.where(:software_info_id => context.profile.software_info.id).destroy_all + OperatingSystem.where( + :software_info_id => context.profile.software_info.id + ).destroy_all + list_operating.each do |operating_system| operating_system.software_info = context.profile.software_info operating_system.save! @@ -252,30 +331,40 @@ class MpogSoftwarePlugin < Noosfero::Plugin institution.save if context.params.has_key?(:governmental_power) - context.profile.institution.governmental_power_id = context.params[:governmental_power] + context.profile.institution.governmental_power_id = + context.params[:governmental_power] + context.profile.institution.save! end if context.params.has_key?(:governmental_sphere) - context.profile.institution.governmental_sphere_id = context.params[:governmental_sphere] + context.profile.institution.governmental_sphere_id = + context.params[:governmental_sphere] + context.profile.institution.save! end if context.params.has_key?(:juridical_nature) - context.profile.institution.juridical_nature_id = context.params[:juridical_nature] + context.profile.institution.juridical_nature_id = + context.params[:juridical_nature] + context.profile.institution.save! end if context.params.has_key?(:institution) Institution.transaction do - context.profile.institution.update_attributes!(context.params[:institution]) + context.profile. + institution. + update_attributes!(context.params[:institution]) end end end def software_info_transaction SoftwareInfo.transaction do - context.profile.software_info.update_attributes!(context.params[:software_info]) + context.profile. + software_info. + update_attributes!(context.params[:software_info]) end end @@ -284,7 +373,9 @@ class MpogSoftwarePlugin < Noosfero::Plugin list_libraries = LibraryHelper.list_libraries(context.params[:library]) if LibraryHelper.valid_list_libraries?(list_libraries) - Library.where(:software_info_id=> context.profile.software_info.id).destroy_all + Library.where( + :software_info_id=> context.profile.software_info.id + ).destroy_all list_libraries.each do |library| library.software_info_id = context.profile.software_info.id @@ -301,7 +392,10 @@ class MpogSoftwarePlugin < Noosfero::Plugin list_databases = DatabaseHelper.list_database(context.params[:database]) if DatabaseHelper.valid_list_database?(list_databases) - SoftwareDatabase.where(:software_info_id => context.profile.software_info.id).destroy_all + SoftwareDatabase.where( + :software_info_id => context.profile.software_info.id + ).destroy_all + list_databases.each do |database| database.software_info = context.profile.software_info database.save! @@ -320,10 +414,14 @@ class MpogSoftwarePlugin < Noosfero::Plugin def language_transaction SoftwareLanguage.transaction do - list_language = SoftwareLanguageHelper.list_language(context.params[:language]) + list_language = SoftwareLanguageHelper.list_language( + context.params[:language] + ) if SoftwareLanguageHelper.valid_list_language?(list_language) - SoftwareLanguage.where(:software_info_id => context.profile.software_info.id).destroy_all + SoftwareLanguage.where( + :software_info_id => context.profile.software_info.id + ).destroy_all list_language.each do |language| language.software_info = context.profile.software_info @@ -337,7 +435,10 @@ class MpogSoftwarePlugin < Noosfero::Plugin def software_categories_transaction ControlledVocabulary.transaction do - context.profile.software_info.software_categories.update_attributes!(context.params[:software_categories]) + context.profile. + software_info. + software_categories. + update_attributes!(context.params[:software_categories]) end end diff --git a/lib/operating_system_helper.rb b/lib/operating_system_helper.rb index 07ee2cb..c983028 100644 --- a/lib/operating_system_helper.rb +++ b/lib/operating_system_helper.rb @@ -1,12 +1,19 @@ module OperatingSystemHelper def self.list_operating_system new_operating_systems - return [] if new_operating_systems.nil? or new_operating_systems.length == 0 + return [] if new_operating_systems.nil? or new_operating_systems.length == 0 list_operating_system = [] new_operating_systems.each do |new_operating_system| - unless SoftwareHelper.all_table_is_empty? new_operating_system, ["operating_system_name_id"] + unless SoftwareHelper.all_table_is_empty?( + new_operating_system, + ["operating_system_name_id"] + ) + operating_system = OperatingSystem.new - operating_system.operating_system_name = OperatingSystemName.find(new_operating_system[:operating_system_name_id]) + operating_system.operating_system_name = OperatingSystemName.find( + new_operating_system[:operating_system_name_id] + ) + operating_system.version = new_operating_system[:version] list_operating_system << operating_system end @@ -15,7 +22,7 @@ module OperatingSystemHelper end def self.valid_list_operating_system? list_operating_system - return false if list_operating_system.nil? or list_operating_system.length == 0 + return !(list_operating_system.nil? || list_operating_system.length == 0) list_operating_system.each do |operating_system| return false unless operating_system.valid? @@ -23,7 +30,7 @@ module OperatingSystemHelper true end - def self.operating_system_as_tables (list_operating_system, have_delete_button = true, show_information = false) + def self.operating_system_as_tables(list_operating_system, have_delete_button = true, show_information = false) extend( ActionView::Helpers::TagHelper, ActionView::Helpers::FormTagHelper, @@ -35,10 +42,16 @@ module OperatingSystemHelper lambdas_list = [] if not show_information - return operating_system_html_structure({:operating_system_name_id => "", :version => ""}, have_delete_button) if list_operating_system.nil? + return operating_system_html_structure( + {:operating_system_name_id => "", :version => ""}, + have_delete_button + ) if list_operating_system.nil? list_operating_system.each do |operating_system| - lambdas_list << operating_system_html_structure(operating_system,have_delete_button) + lambdas_list << operating_system_html_structure( + operating_system, + have_delete_button + ) end else list_operating_system.each do |operating_system| @@ -51,19 +64,43 @@ module OperatingSystemHelper def self.operating_system_html_structure (operating_system_data,have_delete_button = true) Proc::new do - content_tag('table', - content_tag('tr', + content_tag( + 'table', + content_tag( + 'tr', content_tag('td', label_tag(_("Name")))+ - content_tag('td', select_tag("operating_system[][operating_system_name_id]", SoftwareHelper.select_options(OperatingSystemName.all, operating_system_data[:operating_system_name_id]) ))+ + content_tag( + 'td', + select_tag( + "operating_system[][operating_system_name_id]", + SoftwareHelper.select_options( + OperatingSystemName.all, + operating_system_data[:operating_system_name_id] + ) + ) + )+ content_tag('td') )+ - content_tag('tr', + content_tag( + 'tr', content_tag('td', label_tag(_("Version")))+ - content_tag('td', text_field_tag("operating_system[][version]", operating_system_data[:version]))+ + content_tag( + 'td', + text_field_tag( + "operating_system[][version]", + operating_system_data[:version] + ) + )+ if have_delete_button - content_tag('td', - button_without_text(:delete, _('Delete'), "#" , :class=>"delete-dynamic-table"), + content_tag( + 'td', + button_without_text( + :delete, + _('Delete'), + "#" , + :class=>"delete-dynamic-table" + ), :align => 'right' ) else diff --git a/lib/public_institution.rb b/lib/public_institution.rb index 7b5f854..84ade57 100644 --- a/lib/public_institution.rb +++ b/lib/public_institution.rb @@ -1,6 +1,15 @@ class PublicInstitution < Institution - validates :governmental_power, :governmental_sphere, :juridical_nature, :presence=>true - validates :acronym, :allow_blank => true, :allow_nil => true, :uniqueness=>true + validates :governmental_power, :governmental_sphere, :juridical_nature, + :presence=>true + + validates :acronym, :allow_blank => true, :allow_nil => true, + :uniqueness=>true + validates :cnpj, :uniqueness=>true - validates_format_of :cnpj, :with => /^\d{2}\.\d{3}\.\d{3}\/\d{4}\-\d{2}$/, :allow_nil => true, :allow_blank => true + + validates_format_of( + :cnpj, + :with => /^\d{2}\.\d{3}\.\d{3}\/\d{4}\-\d{2}$/, + :allow_nil => true, :allow_blank => true + ) end diff --git a/lib/software_database.rb b/lib/software_database.rb index 9c279e4..ac581c8 100644 --- a/lib/software_database.rb +++ b/lib/software_database.rb @@ -4,10 +4,22 @@ class SoftwareDatabase < ActiveRecord::Base belongs_to :software_info belongs_to :database_description - validates_length_of :version, maximum: 20, too_long: _("Software database is too long (maximum is 20 characters)") - validates_length_of :operating_system, maximum: 20, too_long: _("Software database is too long (maximum is 20 characters)") + validates_length_of( + :version, + :maximum => 20, + :too_long => _("Software database is too long (maximum is 20 characters)") + ) + + validates_length_of( + :operating_system, + :maximum => 20, + :too_long => _("Software database is too long (maximum is 20 characters)") + ) validates_presence_of :database_description_id, :version, :operating_system - validates :database_description_id, :numericality => { :greater_than_or_equal_to => 1 } + validates( + :database_description_id, + :numericality => {:greater_than_or_equal_to => 1} + ) end diff --git a/lib/software_info.rb b/lib/software_info.rb index 27e3601..b810629 100644 --- a/lib/software_info.rb +++ b/lib/software_info.rb @@ -6,9 +6,14 @@ class SoftwareInfo < ActiveRecord::Base 'full' end - attr_accessible :e_mag, :icp_brasil, :intern, :e_ping, :e_arq, :operating_platform - attr_accessible :demonstration_url, :acronym, :objectives, :features, :license_info - attr_accessible :community_id, :finality, :repository_link, :public_software, :first_edit + attr_accessible :e_mag, :icp_brasil, :intern, :e_ping, :e_arq, + :operating_platform + + attr_accessible :demonstration_url, :acronym, :objectives, :features, + :license_info + + attr_accessible :community_id, :finality, :repository_link, :public_software, + :first_edit has_many :libraries, :dependent => :destroy has_many :software_databases @@ -31,7 +36,9 @@ class SoftwareInfo < ActiveRecord::Base # used on find_by_contents scope :like_search, lambda{ |name| - joins(:community).where("name ILIKE ? OR acronym ILIKE ?", "%#{name}%", "%#{name}%") + joins(:community).where( + "name ILIKE ? OR acronym ILIKE ?", "%#{name}%", "%#{name}%" + ) } scope :search, lambda { |name="", database_description_id = "", @@ -57,7 +64,10 @@ class SoftwareInfo < ActiveRecord::Base def validate_name_lenght if self.community.name.size > 100 - self.errors.add(:base, _("Name is too long (maximum is %{count} characters)")) + self.errors.add( + :base, + _("Name is too long (maximum is %{count} characters)") + ) false end true @@ -70,12 +80,23 @@ class SoftwareInfo < ActiveRecord::Base license_info = attributes.delete(:license_info) software_info = SoftwareInfo.new(attributes) if !environment.admins.include? requestor - CreateSoftware.create!(attributes.merge(:requestor => requestor, :environment => environment, :name => name, :license_info => license_info)) + CreateSoftware.create!( + attributes.merge( + :requestor => requestor, + :environment => environment, + :name => name, + :license_info => license_info + ) + ) else software_template = Community["software"] community = Community.new(:name => name) community.environment = environment - community.template_id = software_template.id if (!software_template.blank? && software_template.is_template) + + if (!software_template.blank? && software_template.is_template) + community.template_id = software_template.id + end + software_info.license_info = license_info software_info.save community.software_info = software_info @@ -99,15 +120,21 @@ class SoftwareInfo < ActiveRecord::Base end def valid_operating_systems - self.errors.add(:operating_system, _(": at least one must be filled")) if self.operating_systems.empty? + if self.operating_systems.empty? + self.errors.add(:operating_system, _(": at least one must be filled")) + end end def valid_software_info - self.errors.add(:software_languages, _(": at least one must be filled")) if self.software_languages.empty? + if self.software_languages.empty? + self.errors.add(:software_languages, _(": at least one must be filled")) + end end def valid_databases - self.errors.add(:software_databases, _(": at least one must be filled")) if self.software_databases.empty? + if self.software_databases.empty? + self.errors.add(:software_databases, _(": at least one must be filled")) + end end def visible? diff --git a/lib/software_language.rb b/lib/software_language.rb index 3870ff0..1c99b8b 100644 --- a/lib/software_language.rb +++ b/lib/software_language.rb @@ -4,8 +4,17 @@ class SoftwareLanguage < ActiveRecord::Base belongs_to :software_info belongs_to :programming_language - validates_length_of :version, maximum: 20, too_long: _("Software language is too long (maximum is 20 characters)") - validates_length_of :operating_system, maximum: 20, too_long: _("Software language is too long (maximum is 20 characters)") + validates_length_of( + :version, + :maximum => 20, + :too_long => _("Software language is too long (maximum is 20 characters)") + ) + + validates_length_of( + :operating_system, + :maximum => 20, + :too_long => _("Software language is too long (maximum is 20 characters)") + ) validates_presence_of :version,:programming_language,:operating_system end diff --git a/test/functional/mpog_software_plugin_myprofile_controller_test.rb b/test/functional/mpog_software_plugin_myprofile_controller_test.rb index 66a0988..0ef1a8d 100644 --- a/test/functional/mpog_software_plugin_myprofile_controller_test.rb +++ b/test/functional/mpog_software_plugin_myprofile_controller_test.rb @@ -1,7 +1,10 @@ require File.dirname(__FILE__) + '/../../../../test/test_helper' -require File.dirname(__FILE__) + '/../../controllers/mpog_software_plugin_myprofile_controller' require File.dirname(__FILE__) + '/software_test_helper' require File.dirname(__FILE__) + '/../helpers/institution_test_helper' +require( + File.dirname(__FILE__) + + '/../../controllers/mpog_software_plugin_myprofile_controller' +) class MpogSoftwarePluginMyprofileController; def rescue_action(e) raise e end; end @@ -17,7 +20,11 @@ class MpogSoftwarePluginMyprofileControllerTest < ActionController::TestCase @offer_1 = create_user('Ana de Souza') @offer_2 = create_user('Angelo Roberto') - LicenseInfo.create(:version=>"CC-GPL-V2", :link=>"http://creativecommons.org/licenses/GPL/2.0/legalcode.pt") + LicenseInfo.create( + :version=>"CC-GPL-V2", + :link=>"http://creativecommons.org/licenses/GPL/2.0/legalcode.pt" + ) + ProgrammingLanguage.create(:name =>"language") DatabaseDescription.create(:name => "database") OperatingSystemName.create(:name=>"Debian") @@ -67,28 +74,50 @@ class MpogSoftwarePluginMyprofileControllerTest < ActionController::TestCase should 'create a new software with all fields filled in' do fields = software_fields @environment.add_admin(@person) - post :new_software, :profile => @person.identifier, :community => fields[1], :license_info => fields[0], - :software_info => fields[2] + post( + :new_software, + :profile => @person.identifier, + :community => fields[1], + :license_info => fields[0], + :software_info => fields[2] + ) assert_equal SoftwareInfo.last.community.name, "Debian" end should 'edit a new software adding basic information' do - fields_software = software_fields - fields = software_edit_basic_fields + fields_software = software_fields + fields = software_edit_basic_fields - software = create_software fields_software - post :edit_software, :profile => software.community.identifier, :license => fields[1], :software => fields[0], :library => {}, :operating_system => {}, :language => {}, :database => {} - assert_equal SoftwareInfo.last.repository_link, "www.github.com/test" + software = create_software fields_software + post( + :edit_software, + :profile => software.community.identifier, + :license => fields[1], + :software => fields[0], + :library => {}, + :operating_system => {}, + :language => {}, + :database => {} + ) + assert_equal SoftwareInfo.last.repository_link, "www.github.com/test" end should 'edit a new software adding specific information' do - fields_software = software_fields - fields = software_edit_specific_fields + fields_software = software_fields + fields = software_edit_specific_fields - software = create_software fields_software - post :edit_software, :profile => software.community.identifier, :library => fields[0], :language => fields[1], - :database => fields[2], :operating_system => fields[3], :software => fields[4], :license => fields[5] - assert_equal SoftwareInfo.last.acronym, "test" + software = create_software fields_software + post( + :edit_software, + :profile => software.community.identifier, + :library => fields[0], + :language => fields[1], + :database => fields[2], + :operating_system => fields[3], + :software => fields[4], + :license => fields[5] + ) + assert_equal SoftwareInfo.last.acronym, "test" end should 'upgrade a generic software to a public software' do @@ -97,8 +126,18 @@ class MpogSoftwarePluginMyprofileControllerTest < ActionController::TestCase fields[4]['public_software'] = true software = create_software fields_software - post :edit_software, :profile => software.community.identifier, :library => fields[0], :language => fields[1], - :database => fields[2], :operating_system => fields[3], :software => fields[4], :license => fields[5] + + post( + :edit_software, + :profile => software.community.identifier, + :library => fields[0], + :language => fields[1], + :database => fields[2], + :operating_system => fields[3], + :software => fields[4], + :license => fields[5] + ) + assert_equal true, SoftwareInfo.last.public_software? end @@ -107,12 +146,35 @@ class MpogSoftwarePluginMyprofileControllerTest < ActionController::TestCase govSphere = GovernmentalSphere.create(:name=>"Some Gov Sphere") juridical_nature = JuridicalNature.create(:name => "Autarquia") - institution = InstitutionTestHelper.create_public_institution("Ministerio Publico da Uniao", "MPU", "BR", "DF", "Gama", juridical_nature, govPower, govSphere, "12.345.678/9012-45") - identifier = institution.community.identifier + institution = InstitutionTestHelper.create_public_institution( + "Ministerio Publico da Uniao", + "MPU", + "BR", + "DF", + "Gama", + juridical_nature, + govPower, + govSphere, + "12.345.678/9012-45" + ) - fields = InstitutionTestHelper.generate_form_fields "institution new name", "BR", "DF", "Gama", "12.345.678/9012-45", "PrivateInstitution" + identifier = institution.community.identifier - post :edit_institution, :profile=>institution.community.identifier, :community=>fields[:community], :institutions=>fields[:institutions] + fields = InstitutionTestHelper.generate_form_fields( + "institution new name", + "BR", + "DF", + "Gama", + "12.345.678/9012-45", + "PrivateInstitution" + ) + + post( + :edit_institution, + :profile=>institution.community.identifier, + :community=>fields[:community], + :institutions=>fields[:institutions] + ) institution = Community[identifier].institution assert_not_equal "Ministerio Publico da Uniao", institution.community.name @@ -123,12 +185,35 @@ class MpogSoftwarePluginMyprofileControllerTest < ActionController::TestCase govSphere = GovernmentalSphere.create(:name=>"Some Gov Sphere") juridical_nature = JuridicalNature.create(:name => "Autarquia") - institution = InstitutionTestHelper.create_public_institution("Ministerio Publico da Uniao", "MPU", "BR", "DF", "Gama", juridical_nature, govPower, govSphere, "12.345.678/9012-45") - identifier = institution.community.identifier + institution = InstitutionTestHelper.create_public_institution( + "Ministerio Publico da Uniao", + "MPU", + "BR", + "DF", + "Gama", + juridical_nature, + govPower, + govSphere, + "12.345.678/9012-45" + ) - fields = InstitutionTestHelper.generate_form_fields "", "BR", "DF", "Gama", "6465465465", "PrivateInstitution" + identifier = institution.community.identifier - post :edit_institution, :profile=>institution.community.identifier, :community=>fields[:community], :institutions=>fields[:institutions] + fields = InstitutionTestHelper.generate_form_fields( + "", + "BR", + "DF", + "Gama", + "6465465465", + "PrivateInstitution" + ) + + post( + :edit_institution, + :profile=>institution.community.identifier, + :community=>fields[:community], + :institutions=>fields[:institutions] + ) institution = Community[identifier].institution assert_equal "Ministerio Publico da Uniao", institution.community.name diff --git a/test/functional/profile_editor_controller_test.rb b/test/functional/profile_editor_controller_test.rb index 642f34b..4f0fc9c 100644 --- a/test/functional/profile_editor_controller_test.rb +++ b/test/functional/profile_editor_controller_test.rb @@ -1,6 +1,9 @@ require File.dirname(__FILE__) + '/../../../../test/test_helper' require File.dirname(__FILE__) + '/../helpers/institution_test_helper' -require File.dirname(__FILE__) + '/../../../../app/controllers/my_profile/profile_editor_controller' +require( + File.dirname(__FILE__) + + '/../../../../app/controllers/my_profile/profile_editor_controller' +) class ProfileEditorController; def rescue_action(e) raise e end; end @@ -11,7 +14,13 @@ class ProfileEditorControllerTest < ActionController::TestCase @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new @profile = create_user('default_user').person - Environment.default.affiliate(@profile, [Environment::Roles.admin(Environment.default.id)] + Profile::Roles.all_roles(Environment.default.id)) + + Environment.default.affiliate( + @profile, + [Environment::Roles.admin(Environment.default.id)] + + Profile::Roles.all_roles(Environment.default.id) + ) + @environment = Environment.default @environment.enabled_plugins = ['MpogSoftwarePlugin'] admin = create_user("adminuser").person @@ -25,8 +34,29 @@ class ProfileEditorControllerTest < ActionController::TestCase @juridical_nature = JuridicalNature.create(:name => "Autarquia") @institution_list = [] - @institution_list << InstitutionTestHelper.create_public_institution("Ministerio Publico da Uniao", "MPU", "BR", "DF", "Gama", @juridical_nature, @govPower, @govSphere, "12.345.678/9012-45") - @institution_list << InstitutionTestHelper.create_public_institution("Tribunal Regional da Uniao", "TRU", "BR", "DF", "Brasilia", @juridical_nature, @govPower, @govSphere, "12.345.678/9012-90") + @institution_list << InstitutionTestHelper.create_public_institution( + "Ministerio Publico da Uniao", + "MPU", + "BR", + "DF", + "Gama", + @juridical_nature, + @govPower, + @govSphere, + "12.345.678/9012-45" + ) + + @institution_list << InstitutionTestHelper.create_public_institution( + "Tribunal Regional da Uniao", + "TRU", + "BR", + "DF", + "Brasilia", + @juridical_nature, + @govPower, + @govSphere, + "12.345.678/9012-90" + ) end should "add new institution for user into edit profile" do diff --git a/test/functional/search_controller_test.rb b/test/functional/search_controller_test.rb index 793943c..1a96eaa 100644 --- a/test/functional/search_controller_test.rb +++ b/test/functional/search_controller_test.rb @@ -1,6 +1,9 @@ require File.dirname(__FILE__) + '/../../../../test/test_helper' -require File.dirname(__FILE__) + '/../../../../app/controllers/public/search_controller' require File.dirname(__FILE__) + '/../helpers/plugin_test_helper' +require( + File.dirname(__FILE__) + + '/../../../../app/controllers/public/search_controller' +) class SearchController; def rescue_action(e) raise e end; end @@ -17,58 +20,68 @@ class SearchControllerTest < ActionController::TestCase @request.stubs(:ssl?).returns(:false) @response = ActionController::TestResponse.new - @category_software = Category.create!(:name => _("Software"), :environment => @environment) + @category_software = Category.create!( + :name => _("Software"), + :environment => @environment + ) end - # should "communities searches don't have software or institution" do - # community = create_community("New Community") - # software = create_software_info("New Software") - # institution = create_private_institution("New Private Institution", "NPI" , "Brazil", "DF", "Gama", "66.544.314/0001-63") + should "communities searches don't have software or institution" do + community = create_community("New Community") + software = create_software_info("New Software") + institution = create_private_institution( + "New Private Institution", + "NPI" , + "Brazil", + "DF", + "Gama", + "66.544.314/0001-63" + ) - # get :communities, :query => "New" + get :communities, :query => "New" - # assert_includes assigns(:searches)[:communities][:results], community - # assert_not_includes assigns(:searches)[:communities][:results], software - # assert_not_includes assigns(:searches)[:communities][:results], institution - # end + assert_includes assigns(:searches)[:communities][:results], community + assert_not_includes assigns(:searches)[:communities][:results], software + assert_not_includes assigns(:searches)[:communities][:results], institution + end - # should "software_infos search don't have community or institution" do - # community = create_community("New Community") - # software = create_software_info("New Software") - # institution = create_private_institution("New Private Institution", "NPI" , "Brazil", "DF", "Gama", "66.544.314/0001-63") + should "software_infos search don't have community or institution" do + community = create_community("New Community") + software = create_software_info("New Software") + institution = create_private_institution("New Private Institution", "NPI" , "Brazil", "DF", "Gama", "66.544.314/0001-63") - # get :software_infos, :query => "New" + get :software_infos, :query => "New" - # assert_includes assigns(:searches)[:software_infos][:results], software.community - # assert_not_includes assigns(:searches)[:software_infos][:results], community - # assert_not_includes assigns(:searches)[:software_infos][:results], institution.community - # end + assert_includes assigns(:searches)[:software_infos][:results], software.community + assert_not_includes assigns(:searches)[:software_infos][:results], community + assert_not_includes assigns(:searches)[:software_infos][:results], institution.community + end - # should "software_infos search by category" do - # software_with_category = create_software_info("New Software With Category") - # software_without_category = create_software_info("New Software Without Category") - # category = Category.create!(:name => "Health", :environment => @environment, :parent => @category_software) + should "software_infos search by category" do + software_with_category = create_software_info("New Software With Category") + software_without_category = create_software_info("New Software Without Category") + category = Category.create!(:name => "Health", :environment => @environment, :parent => @category_software) - # software_with_category.community.categories << category - # software_with_category.save! + software_with_category.community.categories << category + software_with_category.save! - # get :software_infos, :query => "New", :filter => category.id + get :software_infos, :query => "New", :filter => category.id - # assert_includes assigns(:searches)[:software_infos][:results], software_with_category.community - # assert_not_includes assigns(:searches)[:software_infos][:results], software_without_category.community - # end + assert_includes assigns(:searches)[:software_infos][:results], software_with_category.community + assert_not_includes assigns(:searches)[:software_infos][:results], software_without_category.community + end - # should "institutions_search don't have community or software" do - # community = create_community("New Community") - # software = create_software_info("New Software") - # institution = create_private_institution("New Private Institution", "NPI" , "Brazil", "DF", "Gama", "66.544.314/0001-63") + should "institutions_search don't have community or software" do + community = create_community("New Community") + software = create_software_info("New Software") + institution = create_private_institution("New Private Institution", "NPI" , "Brazil", "DF", "Gama", "66.544.314/0001-63") - # get :institutions, :query => "New" + get :institutions, :query => "New" - # assert_includes assigns(:searches)[:institutions][:results], institution.community - # assert_not_includes assigns(:searches)[:institutions][:results], community - # assert_not_includes assigns(:searches)[:institutions][:results], software.community - # end + assert_includes assigns(:searches)[:institutions][:results], institution.community + assert_not_includes assigns(:searches)[:institutions][:results], community + assert_not_includes assigns(:searches)[:institutions][:results], software.community + end should "Don't found template in communities search" do community = create_community("New Community") @@ -76,7 +89,14 @@ class SearchControllerTest < ActionController::TestCase software.license_info = LicenseInfo.create(:version => "GPL") software.save! - institution = create_private_institution("New Private Institution", "NPI" , "Brazil", "DF", "Gama", "66.544.314/0001-63") + institution = create_private_institution( + "New Private Institution", + "NPI" , + "Brazil", + "DF", + "Gama", + "66.544.314/0001-63" + ) community_template = create_community("New Community Template") community_template.is_template = true @@ -84,10 +104,14 @@ class SearchControllerTest < ActionController::TestCase get :communities, :query => "New" - assert_includes assigns(:searches)[:communities][:results], community + assert_includes( + assigns(:searches)[:software_infos][:results], + software.community + ) + assert_not_includes assigns(:searches)[:software_infos][:results], community assert_not_includes( - assigns(:searches)[:communities][:results], - community_template + assigns(:searches)[:software_infos][:results], + institution.community ) end @@ -95,10 +119,17 @@ class SearchControllerTest < ActionController::TestCase software_with_category = create_software_info("New Software With Category") software_with_category.license_info = LicenseInfo.create(:version => "GPL") - software_without_category = create_software_info("New Software Without Category") - software_without_category.license_info = LicenseInfo.create(:version => "GPL") + software_without_category = + create_software_info("New Software Without Category") - category = Category.create!(:name => "Health", :environment => @environment, :parent => @category_software) + software_without_category.license_info = + LicenseInfo.create(:version => "GPL") + + category = Category.create!( + :name => "Health", + :environment => @environment, + :parent => @category_software + ) software_template = create_software_info("New Software Template") software_template.license_info = LicenseInfo.last @@ -110,44 +141,37 @@ class SearchControllerTest < ActionController::TestCase assert_includes( assigns(:searches)[:software_infos][:results], - software.community + software_with_category.community ) assert_not_includes( assigns(:searches)[:software_infos][:results], - software_template.community + software_without_category.community ) end - should "Not found template in institutions search" do + should "institutions_search don't have community or software" do + community = create_community("New Community") + software = create_software_info("New Software") institution = create_private_institution( "New Private Institution", - "NPI", + "NPI" , "Brazil", "DF", "Gama", "66.544.314/0001-63" ) - institution_template = create_private_institution( - "New Private Institution Template", - "NPIT", - "Brazil", - "DF", - "Gama", - "66.544.314/0001-63" - ) - institution_template.community.is_template = true - institution_template.community.save! - get :institutions, :query => "New" assert_includes( assigns(:searches)[:institutions][:results], institution.community ) + assert_not_includes assigns(:searches)[:institutions][:results], community assert_not_includes( assigns(:searches)[:institutions][:results], - institution_template.community + software.community ) + end end diff --git a/test/helpers/plugin_test_helper.rb b/test/helpers/plugin_test_helper.rb index daa31f6..10bea2a 100644 --- a/test/helpers/plugin_test_helper.rb +++ b/test/helpers/plugin_test_helper.rb @@ -22,7 +22,14 @@ module PluginTestHelper end def create_private_institution name, acronym, country, state, city, cnpj - InstitutionTestHelper.create_private_institution(name, acronym, country, state, city, cnpj) + InstitutionTestHelper.create_private_institution( + name, + acronym, + country, + state, + city, + cnpj + ) end def create_community_institution name, country, state, city @@ -36,7 +43,13 @@ module PluginTestHelper end def create_person name, email, password, password_confirmation, secondary_email, state, city - user = create_user(name.to_slug, email, password, password_confirmation, secondary_email) + user = create_user( + name.to_slug, + email, + password, + password_confirmation, + secondary_email + ) person = Person::new user.person = person -- libgit2 0.21.2