Commit 98ecbe010b5ca4aac811b93c32aab02f74fe14b5
1 parent
242318b0
Exists in
master
and in
27 other branches
Add functional tests to check if default option is cheched by default
Showing
1 changed file
with
38 additions
and
0 deletions
Show diff stats
test/unit/application_helper_test.rb
... | ... | @@ -254,6 +254,44 @@ class ApplicationHelperTest < ActionView::TestCase |
254 | 254 | end |
255 | 255 | end |
256 | 256 | |
257 | + should 'define the community default template as checked' do | |
258 | + environment = Environment.default | |
259 | + self.stubs(:environment).returns(environment) | |
260 | + community = fast_create(Community, :is_template => true, :environment_id => environment.id) | |
261 | + fast_create(Community, :is_template => true, :environment_id => environment.id) | |
262 | + environment.community_default_template= community | |
263 | + environment.save | |
264 | + | |
265 | + assert_tag_in_string template_options(:communities, 'community'), :tag => 'input', | |
266 | + :attributes => { :name => "community[template_id]", :value => community.id, :checked => true } | |
267 | + end | |
268 | + | |
269 | + should 'define the person default template as checked' do | |
270 | + environment = Environment.default | |
271 | + self.stubs(:environment).returns(environment) | |
272 | + person = fast_create(Person, :is_template => true, :environment_id => environment.id) | |
273 | + fast_create(Person, :is_template => true, :environment_id => environment.id) | |
274 | + environment.person_default_template= person | |
275 | + environment.save | |
276 | + | |
277 | + assert_tag_in_string template_options(:people, 'profile_data'), :tag => 'input', | |
278 | + :attributes => { :name => "profile_data[template_id]", :value => person.id, :checked => true } | |
279 | + end | |
280 | + | |
281 | + should 'define the enterprise default template as checked' do | |
282 | + environment = Environment.default | |
283 | + self.stubs(:environment).returns(environment) | |
284 | + enterprise = fast_create(Enterprise, :is_template => true, :environment_id => environment.id) | |
285 | + fast_create(Enterprise, :is_template => true, :environment_id => environment.id) | |
286 | + | |
287 | + environment.enterprise_default_template= enterprise | |
288 | + environment.save | |
289 | + environment.reload | |
290 | + | |
291 | + assert_tag_in_string template_options(:enterprises, 'create_enterprise'), :tag => 'input', | |
292 | + :attributes => { :name => "create_enterprise[template_id]", :value => enterprise.id, :checked => true } | |
293 | + end | |
294 | + | |
257 | 295 | should 'return nil if disable_categories is enabled' do |
258 | 296 | env = fast_create(Environment, :name => 'env test') |
259 | 297 | stubs(:environment).returns(env) | ... | ... |