diff --git a/app/controllers/public/account_controller.rb b/app/controllers/public/account_controller.rb index 9f445cb..c409d91 100644 --- a/app/controllers/public/account_controller.rb +++ b/app/controllers/public/account_controller.rb @@ -131,7 +131,7 @@ class AccountController < ApplicationController check_join_in_community(@user) go_to_signup_initial_page else - redirect_to :controller => :home, :action => :welcome, :template_id => @user.person.template.id + redirect_to :controller => :home, :action => :welcome, :template_id => (@user.person.template && @user.person.template.id) session[:notice] = _('Thanks for registering!') end end @@ -464,7 +464,7 @@ class AccountController < ApplicationController when 'user_control_panel' redirect_to user.admin_url when 'welcome_page' - redirect_to :controller => :home, :action => :welcome, :template_id => user.template.id + redirect_to :controller => :home, :action => :welcome, :template_id => (user.template && user.template.id) else redirect_back_or_default(default) end diff --git a/test/functional/account_controller_test.rb b/test/functional/account_controller_test.rb index aac1bec..844ef81 100644 --- a/test/functional/account_controller_test.rb +++ b/test/functional/account_controller_test.rb @@ -643,7 +643,7 @@ class AccountControllerTest < ActionController::TestCase :image => fixture_file_upload('/files/rails.png', 'image/png') } - assert_response :success + assert_redirected_to controller: 'home', action: 'welcome' person = Person["testuser"] assert_equal "rails.png", person.image.filename diff --git a/test/integration/signup_test.rb b/test/integration/signup_test.rb index 254c266..415ee90 100644 --- a/test/integration/signup_test.rb +++ b/test/integration/signup_test.rb @@ -12,7 +12,7 @@ class SignupTest < ActionController::IntegrationTest registering_with_bot_test 5, 1 end assert_template 'signup' - assert_match /robot/, response.body + assert_match /robot/, @response.body end def test_signup_form_submission_must_not_block_after_min_signup_delay @@ -41,7 +41,7 @@ class SignupTest < ActionController::IntegrationTest assert_equal mail_count, ActionMailer::Base.deliveries.count post '/account/signup', :user => { :login => 'shouldaccepterms', :password => 'test', :password_confirmation => 'test', :email => 'shouldaccepterms@example.com', :terms_accepted => '1' }, :profile_data => person_data - assert_response :success + assert_redirected_to controller: 'home', action: 'welcome' assert_equal count + 1, User.count assert_equal mail_count + 1, ActionMailer::Base.deliveries.count @@ -58,10 +58,10 @@ class SignupTest < ActionController::IntegrationTest assert_response :success get '/account/signup_time' assert_response :success - data = ActiveSupport::JSON.decode response.body + data = ActiveSupport::JSON.decode @response.body sleep sleep_secs post '/account/signup', :user => { :login => 'someone', :password => 'test', :password_confirmation => 'test', :email => 'someone@example.com' }, :signup_time_key => data['key'] - assert_response :success + sleep_secs > min_signup_delay ? assert_redirected_to(controller: 'home', action: 'welcome') : assert_response(:success) end end -- libgit2 0.21.2