Commit e909e2c66bc0c898aec095141aca44c2555e4147

Authored by Visita
1 parent 862ea7b0

Adding tests for enterprise templates

ActionItem2608
test/functional/enterprise_registration_controller_test.rb
... ... @@ -203,4 +203,21 @@ class EnterpriseRegistrationControllerTest < ActionController::TestCase
203 203 assert_tag :tag => 'input', :attributes => {:id => 'create_enterprise_plugin1', :type => 'hidden', :value => 'Plugin 1'}
204 204 assert_tag :tag => 'input', :attributes => {:id => 'create_enterprise_plugin2', :type => 'hidden', :value => 'Plugin 2'}
205 205 end
  206 +
  207 + should 'display only templates of the current environment' do
  208 + env2 = fast_create(Environment)
  209 +
  210 + template1 = fast_create(Enterprise, :name => 'template1', :environment_id => Environment.default.id, :is_template => true)
  211 + template2 = fast_create(Enterprise, :name => 'template2', :environment_id => Environment.default.id, :is_template => true)
  212 + template3 = fast_create(Enterprise, :name => 'template3', :environment_id => env2.id, :is_template => true)
  213 +
  214 + get :index
  215 +
  216 + assert_select '#template-options' do |elements|
  217 + assert_match /template1/, elements[0].to_s
  218 + assert_match /template2/, elements[0].to_s
  219 + assert_no_match /template3/, elements[0].to_s
  220 + end
  221 + end
  222 +
206 223 end
... ...