Commit 576c5dbe0fbed1e727a93b9a55ed6c1b90ad7486
1 parent
eb5dddac
Exists in
master
and in
27 other branches
added tests for welcome screen settings
Showing
2 changed files
with
38 additions
and
0 deletions
Show diff stats
test/functional/admin_panel_controller_test.rb
... | ... | @@ -73,6 +73,7 @@ class AdminPanelControllerTest < ActionController::TestCase |
73 | 73 | assert_tag :tag => 'textarea', :attributes => { :name => 'environment[terms_of_use]'} |
74 | 74 | assert_tag :tag => 'input', :attributes => { :name => 'environment[signup_welcome_text_subject]'} |
75 | 75 | assert_tag :tag => 'textarea', :attributes => { :name => 'environment[signup_welcome_text_body]'} |
76 | + assert_tag :tag => 'textarea', :attributes => { :name => 'environment[signup_welcome_screen_body]'} | |
76 | 77 | end |
77 | 78 | |
78 | 79 | should 'display form for editing message for disabled enterprise' do |
... | ... | @@ -381,4 +382,13 @@ class AdminPanelControllerTest < ActionController::TestCase |
381 | 382 | assert_not_includes environment.languages, 'en' |
382 | 383 | end |
383 | 384 | |
385 | + should 'save body of signup welcome screen' do | |
386 | + body = "This is my welcome body" | |
387 | + post :site_info, :environment => { :signup_welcome_screen_body => body } | |
388 | + assert_redirected_to :action => 'index' | |
389 | + | |
390 | + assert_equal body, Environment.default.signup_welcome_screen_body | |
391 | + assert !Environment.default.signup_welcome_screen_body.blank? | |
392 | + end | |
393 | + | |
384 | 394 | end | ... | ... |
test/unit/environment_test.rb
... | ... | @@ -1355,4 +1355,32 @@ class EnvironmentTest < ActiveSupport::TestCase |
1355 | 1355 | environment.save! |
1356 | 1356 | assert_equal ['en', 'pt'], environment.available_locales |
1357 | 1357 | end |
1358 | + | |
1359 | + should 'not consider custom welcome screen text if not defined' do | |
1360 | + env = Environment.default | |
1361 | + assert !env.has_custom_welcome_screen? | |
1362 | + end | |
1363 | + | |
1364 | + should 'not consider custom welcome screen text if nil' do | |
1365 | + env = Environment.default | |
1366 | + | |
1367 | + env.signup_welcome_screen_body = nil | |
1368 | + assert !env.has_custom_welcome_screen? | |
1369 | + end | |
1370 | + | |
1371 | + should 'consider signup welcome screen if body is defined' do | |
1372 | + env = Environment.default | |
1373 | + env.signup_welcome_screen_body = 'Welcome to the environment' | |
1374 | + assert env.has_custom_welcome_screen? | |
1375 | + end | |
1376 | + | |
1377 | + should 'store custom welcome screen body' do | |
1378 | + environment = Environment.default | |
1379 | + | |
1380 | + environment.signup_welcome_screen_body = 'Welcome to the environment' | |
1381 | + environment.save | |
1382 | + environment.reload | |
1383 | + | |
1384 | + assert_equal 'Welcome to the environment', environment.signup_welcome_screen_body | |
1385 | + end | |
1358 | 1386 | end | ... | ... |