diff --git a/app/models/profile.rb b/app/models/profile.rb index 3479fde..5ed0956 100644 --- a/app/models/profile.rb +++ b/app/models/profile.rb @@ -231,7 +231,7 @@ class Profile < ActiveRecord::Base # instances. def create_default_set_of_boxes if template - copy_blocks_from template + apply_template(template, :copy_articles => false) else 3.times do self.boxes << Box.new @@ -264,9 +264,9 @@ class Profile < ActiveRecord::Base nil end - def apply_template(template) + def apply_template(template, options = {:copy_articles => true}) copy_blocks_from(template) - copy_articles_from(template) + copy_articles_from(template) if options[:copy_articles] # copy interesting attributes self.layout_template = template.layout_template diff --git a/test/unit/profile_test.rb b/test/unit/profile_test.rb index 0c5a861..d6799d1 100644 --- a/test/unit/profile_test.rb +++ b/test/unit/profile_test.rb @@ -1359,6 +1359,17 @@ class ProfileTest < Test::Unit::TestCase assert !profile.valid? end + should 'copy header and footer after create a person' do + template = create_user('template').person + template.custom_footer = "footer customized" + template.custom_header = "header customized" + Environment.any_instance.stubs(:person_template).returns(template) + + person = create_user('mytestuser').person + assert_equal "footer customized", person.custom_footer + assert_equal "header customized", person.custom_header + end + private def assert_invalid_identifier(id) -- libgit2 0.21.2