From e909e2c66bc0c898aec095141aca44c2555e4147 Mon Sep 17 00:00:00 2001 From: Visita Date: Mon, 15 Apr 2013 11:31:31 -0300 Subject: [PATCH] Adding tests for enterprise templates --- test/functional/enterprise_registration_controller_test.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+), 0 deletions(-) diff --git a/test/functional/enterprise_registration_controller_test.rb b/test/functional/enterprise_registration_controller_test.rb index 478b8c6..11b8b85 100644 --- a/test/functional/enterprise_registration_controller_test.rb +++ b/test/functional/enterprise_registration_controller_test.rb @@ -203,4 +203,21 @@ class EnterpriseRegistrationControllerTest < ActionController::TestCase assert_tag :tag => 'input', :attributes => {:id => 'create_enterprise_plugin1', :type => 'hidden', :value => 'Plugin 1'} assert_tag :tag => 'input', :attributes => {:id => 'create_enterprise_plugin2', :type => 'hidden', :value => 'Plugin 2'} end + + should 'display only templates of the current environment' do + env2 = fast_create(Environment) + + template1 = fast_create(Enterprise, :name => 'template1', :environment_id => Environment.default.id, :is_template => true) + template2 = fast_create(Enterprise, :name => 'template2', :environment_id => Environment.default.id, :is_template => true) + template3 = fast_create(Enterprise, :name => 'template3', :environment_id => env2.id, :is_template => true) + + get :index + + assert_select '#template-options' do |elements| + assert_match /template1/, elements[0].to_s + assert_match /template2/, elements[0].to_s + assert_no_match /template3/, elements[0].to_s + end + end + end -- libgit2 0.21.2