Commit 4f784bd73d47e43a4b20fb94e3c8b4dfa3598bd6
1 parent
79d66909
Exists in
master
and in
28 other branches
template-tests: add is_template to fix templates tests
Showing
4 changed files
with
9 additions
and
8 deletions
Show diff stats
test/functional/account_controller_test.rb
| ... | ... | @@ -574,6 +574,7 @@ class AccountControllerTest < ActionController::TestCase |
| 574 | 574 | |
| 575 | 575 | should 'use the current environment for the template of user' do |
| 576 | 576 | template = create_user('test_template', :email => 'test@bli.com', :password => 'pass', :password_confirmation => 'pass').person |
| 577 | + template.is_template = true | |
| 577 | 578 | template.boxes.destroy_all |
| 578 | 579 | template.boxes << Box.new |
| 579 | 580 | template.boxes[0].blocks << Block.new | ... | ... |
test/functional/memberships_controller_test.rb
| ... | ... | @@ -134,7 +134,7 @@ class MembershipsControllerTest < ActionController::TestCase |
| 134 | 134 | end |
| 135 | 135 | |
| 136 | 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 | 138 | template.boxes.destroy_all |
| 139 | 139 | template.boxes << Box.new |
| 140 | 140 | template.boxes[0].blocks << Block.new | ... | ... |
test/unit/enterprise_test.rb
| ... | ... | @@ -157,7 +157,7 @@ class EnterpriseTest < ActiveSupport::TestCase |
| 157 | 157 | end |
| 158 | 158 | |
| 159 | 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 | 161 | template.boxes.destroy_all |
| 162 | 162 | template.boxes << Box.new |
| 163 | 163 | template.boxes[0].blocks << Block.new |
| ... | ... | @@ -178,7 +178,7 @@ class EnterpriseTest < ActiveSupport::TestCase |
| 178 | 178 | end |
| 179 | 179 | |
| 180 | 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 | 182 | inactive_template.boxes.destroy_all |
| 183 | 183 | inactive_template.boxes << Box.new |
| 184 | 184 | inactive_template.save! |
| ... | ... | @@ -358,7 +358,7 @@ class EnterpriseTest < ActiveSupport::TestCase |
| 358 | 358 | end |
| 359 | 359 | |
| 360 | 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 | 362 | inactive_template.boxes.destroy_all |
| 363 | 363 | inactive_template.boxes << Box.new |
| 364 | 364 | inactive_template.save! |
| ... | ... | @@ -373,7 +373,7 @@ class EnterpriseTest < ActiveSupport::TestCase |
| 373 | 373 | end |
| 374 | 374 | |
| 375 | 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 | 377 | inactive_template.boxes.destroy_all |
| 378 | 378 | inactive_template.boxes << Box.new |
| 379 | 379 | inactive_template.save! | ... | ... |
test/unit/environment_test.rb
| ... | ... | @@ -500,15 +500,15 @@ class EnvironmentTest < ActiveSupport::TestCase |
| 500 | 500 | should 'set templates' do |
| 501 | 501 | e = fast_create(Environment) |
| 502 | 502 | |
| 503 | - comm = fast_create(Community) | |
| 503 | + comm = fast_create(Community, :is_template => true) | |
| 504 | 504 | e.community_template = comm |
| 505 | 505 | assert_equal comm, e.community_template |
| 506 | 506 | |
| 507 | - person = fast_create(Person) | |
| 507 | + person = fast_create(Person, :is_template => true) | |
| 508 | 508 | e.person_template = person |
| 509 | 509 | assert_equal person, e.person_template |
| 510 | 510 | |
| 511 | - enterprise = fast_create(Enterprise) | |
| 511 | + enterprise = fast_create(Enterprise, :is_template => true) | |
| 512 | 512 | e.enterprise_template = enterprise |
| 513 | 513 | assert_equal enterprise, e.enterprise_template |
| 514 | 514 | end | ... | ... |