diff --git a/test/functional/templates_controller_test.rb b/test/functional/templates_controller_test.rb index 8c031ad..266fc16 100644 --- a/test/functional/templates_controller_test.rb +++ b/test/functional/templates_controller_test.rb @@ -157,5 +157,42 @@ class TemplatesControllerTest < ActionController::TestCase assert_equal "Enterprise not found. The template could no be changed.", session[:notice] end + should 'display set as default link for non default community templates' do + c1 = fast_create(Community, :is_template => true, :environment_id => environment.id) + c2 = fast_create(Community, :is_template => true, :environment_id => environment.id) + + get :index + assert_tag :a, '', :attributes => {:href => "/admin/templates/set_community_as_default?template_id=#{c1.id}"} + assert_tag :a, '', :attributes => {:href => "/admin/templates/set_community_as_default?template_id=#{c2.id}"} + end + + should 'display set as default link for non default person templates' do + p1 = fast_create(Person, :is_template => true, :environment_id => environment.id) + p2 = fast_create(Person, :is_template => true, :environment_id => environment.id) + + get :index + assert_tag :a, '', :attributes => {:href => "/admin/templates/set_person_as_default?template_id=#{p1.id}"} + assert_tag :a, '', :attributes => {:href => "/admin/templates/set_person_as_default?template_id=#{p2.id}"} + end + + should 'display set as default link for non default enterprise templates' do + e1 = fast_create(Enterprise, :is_template => true, :environment_id => environment.id) + e2 = fast_create(Enterprise, :is_template => true, :environment_id => environment.id) + + get :index + assert_tag :a, '', :attributes => {:href => "/admin/templates/set_enterprise_as_default?template_id=#{e1.id}"} + assert_tag :a, '', :attributes => {:href => "/admin/templates/set_enterprise_as_default?template_id=#{e2.id}"} + end + + should 'not display set as default link for default community template' do + c1 = fast_create(Community, :is_template => true, :environment_id => environment.id) + c2 = fast_create(Community, :is_template => true, :environment_id => environment.id) + environment.community_default_template= c1 + environment.save + + get :index + assert_no_tag :a, '', :attributes => {:href => "/admin/templates/set_community_as_default?template_id=#{c1.id}"} + end + end -- libgit2 0.21.2