Commit 7372a547d47a5204e1f3c428488d812ba13d721f

Authored by Victor Costa
1 parent 15c2ef25

rails3: fix profile_editor_controller tests

app/mailers/task_mailer.rb
@@ -9,7 +9,7 @@ class TaskMailer < ActionMailer::Base @@ -9,7 +9,7 @@ class TaskMailer < ActionMailer::Base
9 @tasks_url = url_for_tasks_list 9 @tasks_url = url_for_tasks_list
10 10
11 mail( 11 mail(
12 - to: task.target.notification_emails, 12 + to: task.target.notification_emails.compact,
13 from: self.class.generate_from(task), 13 from: self.class.generate_from(task),
14 subject: "[%s] %s" % [task.environment.name, task.target_notification_description] 14 subject: "[%s] %s" % [task.environment.name, task.target_notification_description]
15 ) 15 )
app/models/organization.rb
1 # Represents any organization of the system 1 # Represents any organization of the system
2 class Organization < Profile 2 class Organization < Profile
3 3
4 - attr_accessible :moderated_articles, :foundation_year 4 + attr_accessible :moderated_articles, :foundation_year, :contact_person, :acronym, :legal_form, :economic_activity, :management_information
5 5
6 SEARCH_FILTERS += %w[ 6 SEARCH_FILTERS += %w[
7 more_popular 7 more_popular
app/models/person.rb
1 # A person is the profile of an user holding all relationships with the rest of the system 1 # A person is the profile of an user holding all relationships with the rest of the system
2 class Person < Profile 2 class Person < Profile
3 3
4 - attr_accessible :organization 4 + attr_accessible :organization, :contact_information, :sex
5 5
6 SEARCH_FILTERS += %w[ 6 SEARCH_FILTERS += %w[
7 more_popular 7 more_popular
app/models/profile.rb
@@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
3 # which by default is the one returned by Environment:default. 3 # which by default is the one returned by Environment:default.
4 class Profile < ActiveRecord::Base 4 class Profile < ActiveRecord::Base
5 5
6 - attr_accessible :name, :identifier, :public_profile, :nickname, :custom_footer, :custom_header, :address, :zip_code, :contact_phone, :image_builder, :description, :closed, :template_id, :environment, :lat, :lng, :is_template 6 + attr_accessible :name, :identifier, :public_profile, :nickname, :custom_footer, :custom_header, :address, :zip_code, :contact_phone, :image_builder, :description, :closed, :template_id, :environment, :lat, :lng, :is_template, :fields_privacy, :preferred_domain_id, :category_ids
7 7
8 # use for internationalizable human type names in search facets 8 # use for internationalizable human type names in search facets
9 # reimplement on subclasses 9 # reimplement on subclasses
@@ -820,7 +820,7 @@ private :generate_url, :url_options @@ -820,7 +820,7 @@ private :generate_url, :url_options
820 def update_header_and_footer(header, footer) 820 def update_header_and_footer(header, footer)
821 self.custom_header = header 821 self.custom_header = header
822 self.custom_footer = footer 822 self.custom_footer = footer
823 - self.save(false) 823 + self.save(:validate => false)
824 end 824 end
825 825
826 def update_theme(theme) 826 def update_theme(theme)
test/functional/profile_editor_controller_test.rb
@@ -99,6 +99,7 @@ class ProfileEditorControllerTest &lt; ActionController::TestCase @@ -99,6 +99,7 @@ class ProfileEditorControllerTest &lt; ActionController::TestCase
99 legal_form = "name <strong id='name_html_test'>with</strong> html" 99 legal_form = "name <strong id='name_html_test'>with</strong> html"
100 economic_activity = "name <strong id='name_html_test'>with</strong> html" 100 economic_activity = "name <strong id='name_html_test'>with</strong> html"
101 management_information = "name <strong id='name_html_test'>with</strong> html" 101 management_information = "name <strong id='name_html_test'>with</strong> html"
  102 + name = "name <strong id='name_html_test'>with</strong> html"
102 103
103 post :edit, :profile => org.identifier, :profile_data => { :name => name, :contact_person => contact, :acronym => acronym, :legal_form => legal_form, :economic_activity => economic_activity, :management_information => management_information} 104 post :edit, :profile => org.identifier, :profile_data => { :name => name, :contact_person => contact, :acronym => acronym, :legal_form => legal_form, :economic_activity => economic_activity, :management_information => management_information}
104 105
@@ -491,8 +492,8 @@ class ProfileEditorControllerTest &lt; ActionController::TestCase @@ -491,8 +492,8 @@ class ProfileEditorControllerTest &lt; ActionController::TestCase
491 person.save! 492 person.save!
492 493
493 get :header_footer, :profile => profile.identifier 494 get :header_footer, :profile => profile.identifier
494 - assert_tag :tag => 'textarea', :content => 'my custom header'  
495 - assert_tag :tag => 'textarea', :content => 'my custom footer' 495 + assert_tag :tag => 'textarea', :content => /my custom header/
  496 + assert_tag :tag => 'textarea', :content => /my custom footer/
496 end 497 end
497 498
498 should 'render TinyMce Editor for header and footer' do 499 should 'render TinyMce Editor for header and footer' do