Commit 4f784bd73d47e43a4b20fb94e3c8b4dfa3598bd6

Authored by Rodrigo Souto
1 parent 79d66909

template-tests: add is_template to fix templates tests

test/functional/account_controller_test.rb
@@ -574,6 +574,7 @@ class AccountControllerTest < ActionController::TestCase @@ -574,6 +574,7 @@ class AccountControllerTest < ActionController::TestCase
574 574
575 should 'use the current environment for the template of user' do 575 should 'use the current environment for the template of user' do
576 template = create_user('test_template', :email => 'test@bli.com', :password => 'pass', :password_confirmation => 'pass').person 576 template = create_user('test_template', :email => 'test@bli.com', :password => 'pass', :password_confirmation => 'pass').person
  577 + template.is_template = true
577 template.boxes.destroy_all 578 template.boxes.destroy_all
578 template.boxes << Box.new 579 template.boxes << Box.new
579 template.boxes[0].blocks << Block.new 580 template.boxes[0].blocks << Block.new
test/functional/memberships_controller_test.rb
@@ -134,7 +134,7 @@ class MembershipsControllerTest &lt; ActionController::TestCase @@ -134,7 +134,7 @@ class MembershipsControllerTest &lt; ActionController::TestCase
134 end 134 end
135 135
136 should 'use the current environment for the template of user' do 136 should 'use the current environment for the template of user' do
137 - template = Community.create!(:identifier => 'test_template', :name => 'test@bli.com') 137 + template = Community.create!(:identifier => 'test_template', :name => 'test@bli.com', :is_template => true)
138 template.boxes.destroy_all 138 template.boxes.destroy_all
139 template.boxes << Box.new 139 template.boxes << Box.new
140 template.boxes[0].blocks << Block.new 140 template.boxes[0].blocks << Block.new
test/unit/enterprise_test.rb
@@ -157,7 +157,7 @@ class EnterpriseTest &lt; ActiveSupport::TestCase @@ -157,7 +157,7 @@ class EnterpriseTest &lt; ActiveSupport::TestCase
157 end 157 end
158 158
159 should 'replace template if environment allows' do 159 should 'replace template if environment allows' do
160 - template = fast_create(Enterprise, :name => 'template enteprise', :identifier => 'template_enterprise', :enabled => false) 160 + template = fast_create(Enterprise, :name => 'template enteprise', :identifier => 'template_enterprise', :enabled => false, :is_template => true)
161 template.boxes.destroy_all 161 template.boxes.destroy_all
162 template.boxes << Box.new 162 template.boxes << Box.new
163 template.boxes[0].blocks << Block.new 163 template.boxes[0].blocks << Block.new
@@ -178,7 +178,7 @@ class EnterpriseTest &lt; ActiveSupport::TestCase @@ -178,7 +178,7 @@ class EnterpriseTest &lt; ActiveSupport::TestCase
178 end 178 end
179 179
180 should 'not replace template if environment doesnt allow' do 180 should 'not replace template if environment doesnt allow' do
181 - inactive_template = fast_create(Enterprise, :name => 'inactive enteprise template', :identifier => 'inactive_enterprise_template') 181 + inactive_template = fast_create(Enterprise, :name => 'inactive enteprise template', :identifier => 'inactive_enterprise_template', :is_template => true)
182 inactive_template.boxes.destroy_all 182 inactive_template.boxes.destroy_all
183 inactive_template.boxes << Box.new 183 inactive_template.boxes << Box.new
184 inactive_template.save! 184 inactive_template.save!
@@ -358,7 +358,7 @@ class EnterpriseTest &lt; ActiveSupport::TestCase @@ -358,7 +358,7 @@ class EnterpriseTest &lt; ActiveSupport::TestCase
358 end 358 end
359 359
360 should 'have inactive_template when creating enterprise and feature is enabled' do 360 should 'have inactive_template when creating enterprise and feature is enabled' do
361 - inactive_template = fast_create(Enterprise, :name => 'inactive enteprise template', :identifier => 'inactive_enterprise_template') 361 + inactive_template = fast_create(Enterprise, :name => 'inactive enteprise template', :identifier => 'inactive_enterprise_template', :is_template => true)
362 inactive_template.boxes.destroy_all 362 inactive_template.boxes.destroy_all
363 inactive_template.boxes << Box.new 363 inactive_template.boxes << Box.new
364 inactive_template.save! 364 inactive_template.save!
@@ -373,7 +373,7 @@ class EnterpriseTest &lt; ActiveSupport::TestCase @@ -373,7 +373,7 @@ class EnterpriseTest &lt; ActiveSupport::TestCase
373 end 373 end
374 374
375 should 'have active_template when creating enterprise and feature is disabled' do 375 should 'have active_template when creating enterprise and feature is disabled' do
376 - inactive_template = fast_create(Enterprise, :name => 'inactive enteprise template', :identifier => 'inactive_enterprise_template') 376 + inactive_template = fast_create(Enterprise, :name => 'inactive enteprise template', :identifier => 'inactive_enterprise_template', :is_template => true)
377 inactive_template.boxes.destroy_all 377 inactive_template.boxes.destroy_all
378 inactive_template.boxes << Box.new 378 inactive_template.boxes << Box.new
379 inactive_template.save! 379 inactive_template.save!
test/unit/environment_test.rb
@@ -500,15 +500,15 @@ class EnvironmentTest &lt; ActiveSupport::TestCase @@ -500,15 +500,15 @@ class EnvironmentTest &lt; ActiveSupport::TestCase
500 should 'set templates' do 500 should 'set templates' do
501 e = fast_create(Environment) 501 e = fast_create(Environment)
502 502
503 - comm = fast_create(Community) 503 + comm = fast_create(Community, :is_template => true)
504 e.community_template = comm 504 e.community_template = comm
505 assert_equal comm, e.community_template 505 assert_equal comm, e.community_template
506 506
507 - person = fast_create(Person) 507 + person = fast_create(Person, :is_template => true)
508 e.person_template = person 508 e.person_template = person
509 assert_equal person, e.person_template 509 assert_equal person, e.person_template
510 510
511 - enterprise = fast_create(Enterprise) 511 + enterprise = fast_create(Enterprise, :is_template => true)
512 e.enterprise_template = enterprise 512 e.enterprise_template = enterprise
513 assert_equal enterprise, e.enterprise_template 513 assert_equal enterprise, e.enterprise_template
514 end 514 end