Commit d6f4caa49dcdc6949a28a1b7e2437f0978dd19be
1 parent
98ecbe01
Exists in
master
and in
22 other branches
Add tests to check the presence of set_as_default link
Showing
1 changed file
with
37 additions
and
0 deletions
Show diff stats
test/functional/templates_controller_test.rb
| ... | ... | @@ -157,5 +157,42 @@ class TemplatesControllerTest < ActionController::TestCase |
| 157 | 157 | assert_equal "Enterprise not found. The template could no be changed.", session[:notice] |
| 158 | 158 | end |
| 159 | 159 | |
| 160 | + should 'display set as default link for non default community templates' do | |
| 161 | + c1 = fast_create(Community, :is_template => true, :environment_id => environment.id) | |
| 162 | + c2 = fast_create(Community, :is_template => true, :environment_id => environment.id) | |
| 163 | + | |
| 164 | + get :index | |
| 165 | + assert_tag :a, '', :attributes => {:href => "/admin/templates/set_community_as_default?template_id=#{c1.id}"} | |
| 166 | + assert_tag :a, '', :attributes => {:href => "/admin/templates/set_community_as_default?template_id=#{c2.id}"} | |
| 167 | + end | |
| 168 | + | |
| 169 | + should 'display set as default link for non default person templates' do | |
| 170 | + p1 = fast_create(Person, :is_template => true, :environment_id => environment.id) | |
| 171 | + p2 = fast_create(Person, :is_template => true, :environment_id => environment.id) | |
| 172 | + | |
| 173 | + get :index | |
| 174 | + assert_tag :a, '', :attributes => {:href => "/admin/templates/set_person_as_default?template_id=#{p1.id}"} | |
| 175 | + assert_tag :a, '', :attributes => {:href => "/admin/templates/set_person_as_default?template_id=#{p2.id}"} | |
| 176 | + end | |
| 177 | + | |
| 178 | + should 'display set as default link for non default enterprise templates' do | |
| 179 | + e1 = fast_create(Enterprise, :is_template => true, :environment_id => environment.id) | |
| 180 | + e2 = fast_create(Enterprise, :is_template => true, :environment_id => environment.id) | |
| 181 | + | |
| 182 | + get :index | |
| 183 | + assert_tag :a, '', :attributes => {:href => "/admin/templates/set_enterprise_as_default?template_id=#{e1.id}"} | |
| 184 | + assert_tag :a, '', :attributes => {:href => "/admin/templates/set_enterprise_as_default?template_id=#{e2.id}"} | |
| 185 | + end | |
| 186 | + | |
| 187 | + should 'not display set as default link for default community template' do | |
| 188 | + c1 = fast_create(Community, :is_template => true, :environment_id => environment.id) | |
| 189 | + c2 = fast_create(Community, :is_template => true, :environment_id => environment.id) | |
| 190 | + environment.community_default_template= c1 | |
| 191 | + environment.save | |
| 192 | + | |
| 193 | + get :index | |
| 194 | + assert_no_tag :a, '', :attributes => {:href => "/admin/templates/set_community_as_default?template_id=#{c1.id}"} | |
| 195 | + end | |
| 196 | + | |
| 160 | 197 | end |
| 161 | 198 | ... | ... |