Commit fb2821ebdfddccb4fb07291a6e73dc5c09aacae1
1 parent
e11edaa4
Exists in
master
and in
29 other branches
[welcome-page] Fixes integration tests for Noosfero 1.0
Showing
3 changed files
with
7 additions
and
7 deletions
Show diff stats
app/controllers/public/account_controller.rb
| ... | ... | @@ -131,7 +131,7 @@ class AccountController < ApplicationController |
| 131 | 131 | check_join_in_community(@user) |
| 132 | 132 | go_to_signup_initial_page |
| 133 | 133 | else |
| 134 | - redirect_to :controller => :home, :action => :welcome, :template_id => @user.person.template.id | |
| 134 | + redirect_to :controller => :home, :action => :welcome, :template_id => (@user.person.template && @user.person.template.id) | |
| 135 | 135 | session[:notice] = _('Thanks for registering!') |
| 136 | 136 | end |
| 137 | 137 | end |
| ... | ... | @@ -464,7 +464,7 @@ class AccountController < ApplicationController |
| 464 | 464 | when 'user_control_panel' |
| 465 | 465 | redirect_to user.admin_url |
| 466 | 466 | when 'welcome_page' |
| 467 | - redirect_to :controller => :home, :action => :welcome, :template_id => user.template.id | |
| 467 | + redirect_to :controller => :home, :action => :welcome, :template_id => (user.template && user.template.id) | |
| 468 | 468 | else |
| 469 | 469 | redirect_back_or_default(default) |
| 470 | 470 | end | ... | ... |
test/functional/account_controller_test.rb
| ... | ... | @@ -643,7 +643,7 @@ class AccountControllerTest < ActionController::TestCase |
| 643 | 643 | :image => fixture_file_upload('/files/rails.png', 'image/png') |
| 644 | 644 | } |
| 645 | 645 | |
| 646 | - assert_response :success | |
| 646 | + assert_redirected_to controller: 'home', action: 'welcome' | |
| 647 | 647 | |
| 648 | 648 | person = Person["testuser"] |
| 649 | 649 | assert_equal "rails.png", person.image.filename | ... | ... |
test/integration/signup_test.rb
| ... | ... | @@ -12,7 +12,7 @@ class SignupTest < ActionController::IntegrationTest |
| 12 | 12 | registering_with_bot_test 5, 1 |
| 13 | 13 | end |
| 14 | 14 | assert_template 'signup' |
| 15 | - assert_match /robot/, response.body | |
| 15 | + assert_match /robot/, @response.body | |
| 16 | 16 | end |
| 17 | 17 | |
| 18 | 18 | def test_signup_form_submission_must_not_block_after_min_signup_delay |
| ... | ... | @@ -41,7 +41,7 @@ class SignupTest < ActionController::IntegrationTest |
| 41 | 41 | assert_equal mail_count, ActionMailer::Base.deliveries.count |
| 42 | 42 | |
| 43 | 43 | post '/account/signup', :user => { :login => 'shouldaccepterms', :password => 'test', :password_confirmation => 'test', :email => 'shouldaccepterms@example.com', :terms_accepted => '1' }, :profile_data => person_data |
| 44 | - assert_response :success | |
| 44 | + assert_redirected_to controller: 'home', action: 'welcome' | |
| 45 | 45 | |
| 46 | 46 | assert_equal count + 1, User.count |
| 47 | 47 | assert_equal mail_count + 1, ActionMailer::Base.deliveries.count |
| ... | ... | @@ -58,10 +58,10 @@ class SignupTest < ActionController::IntegrationTest |
| 58 | 58 | assert_response :success |
| 59 | 59 | get '/account/signup_time' |
| 60 | 60 | assert_response :success |
| 61 | - data = ActiveSupport::JSON.decode response.body | |
| 61 | + data = ActiveSupport::JSON.decode @response.body | |
| 62 | 62 | sleep sleep_secs |
| 63 | 63 | post '/account/signup', :user => { :login => 'someone', :password => 'test', :password_confirmation => 'test', :email => 'someone@example.com' }, :signup_time_key => data['key'] |
| 64 | - assert_response :success | |
| 64 | + sleep_secs > min_signup_delay ? assert_redirected_to(controller: 'home', action: 'welcome') : assert_response(:success) | |
| 65 | 65 | end |
| 66 | 66 | |
| 67 | 67 | end | ... | ... |