diff --git a/test/functional/admin_panel_controller_test.rb b/test/functional/admin_panel_controller_test.rb index 5de2332..77c889a 100644 --- a/test/functional/admin_panel_controller_test.rb +++ b/test/functional/admin_panel_controller_test.rb @@ -73,6 +73,7 @@ class AdminPanelControllerTest < ActionController::TestCase assert_tag :tag => 'textarea', :attributes => { :name => 'environment[terms_of_use]'} assert_tag :tag => 'input', :attributes => { :name => 'environment[signup_welcome_text_subject]'} assert_tag :tag => 'textarea', :attributes => { :name => 'environment[signup_welcome_text_body]'} + assert_tag :tag => 'textarea', :attributes => { :name => 'environment[signup_welcome_screen_body]'} end should 'display form for editing message for disabled enterprise' do @@ -381,4 +382,13 @@ class AdminPanelControllerTest < ActionController::TestCase assert_not_includes environment.languages, 'en' end + should 'save body of signup welcome screen' do + body = "This is my welcome body" + post :site_info, :environment => { :signup_welcome_screen_body => body } + assert_redirected_to :action => 'index' + + assert_equal body, Environment.default.signup_welcome_screen_body + assert !Environment.default.signup_welcome_screen_body.blank? + end + end diff --git a/test/unit/environment_test.rb b/test/unit/environment_test.rb index cd901cc..47df02c 100644 --- a/test/unit/environment_test.rb +++ b/test/unit/environment_test.rb @@ -1355,4 +1355,32 @@ class EnvironmentTest < ActiveSupport::TestCase environment.save! assert_equal ['en', 'pt'], environment.available_locales end + + should 'not consider custom welcome screen text if not defined' do + env = Environment.default + assert !env.has_custom_welcome_screen? + end + + should 'not consider custom welcome screen text if nil' do + env = Environment.default + + env.signup_welcome_screen_body = nil + assert !env.has_custom_welcome_screen? + end + + should 'consider signup welcome screen if body is defined' do + env = Environment.default + env.signup_welcome_screen_body = 'Welcome to the environment' + assert env.has_custom_welcome_screen? + end + + should 'store custom welcome screen body' do + environment = Environment.default + + environment.signup_welcome_screen_body = 'Welcome to the environment' + environment.save + environment.reload + + assert_equal 'Welcome to the environment', environment.signup_welcome_screen_body + end end -- libgit2 0.21.2