Commit 7e2ba029df2c91e49a1d31cbc9667f826d80c300
1 parent
a99b94fa
Exists in
master
and in
29 other branches
Fixed broken and removed unused tests
(ActionItem3096)
Showing
2 changed files
with
15 additions
and
18 deletions
Show diff stats
app/controllers/public/account_controller.rb
... | ... | @@ -36,7 +36,7 @@ class AccountController < ApplicationController |
36 | 36 | self.current_user ||= User.authenticate(params[:user][:login], params[:user][:password], environment) if params[:user] |
37 | 37 | |
38 | 38 | if logged_in? |
39 | - join_community(self.current_user) | |
39 | + check_join_in_community(self.current_user) | |
40 | 40 | if params[:remember_me] == "1" |
41 | 41 | self.current_user.remember_me |
42 | 42 | cookies[:auth_token] = { :value => self.current_user.remember_token , :expires => self.current_user.remember_token_expires_at } |
... | ... | @@ -104,7 +104,7 @@ class AccountController < ApplicationController |
104 | 104 | end |
105 | 105 | if @user.activated? |
106 | 106 | self.current_user = @user |
107 | - join_community(@user) | |
107 | + check_join_in_community(@user) | |
108 | 108 | go_to_signup_initial_page |
109 | 109 | else |
110 | 110 | @register_pending = true |
... | ... | @@ -453,7 +453,7 @@ class AccountController < ApplicationController |
453 | 453 | end |
454 | 454 | end |
455 | 455 | |
456 | - def join_community(user) | |
456 | + def check_join_in_community(user) | |
457 | 457 | profile_to_join = session[:join] |
458 | 458 | unless profile_to_join.blank? |
459 | 459 | environment.profiles.find_by_identifier(profile_to_join).add_member(user.person) | ... | ... |
test/functional/profile_controller_test.rb
... | ... | @@ -477,17 +477,23 @@ class ProfileControllerTest < ActionController::TestCase |
477 | 477 | assert_equal "/profile/#{community.identifier}", @request.session[:previous_location] |
478 | 478 | end |
479 | 479 | |
480 | - should 'redirect to location before login after join community' do | |
480 | + should 'redirect to login after user not logged asks to join a community' do | |
481 | 481 | community = Community.create!(:name => 'my test community') |
482 | 482 | |
483 | - @request.expects(:referer).returns("/profile/#{community.identifier}/to_go") | |
484 | - login_as(profile.identifier) | |
483 | + get :join_not_logged, :profile => community.identifier | |
485 | 484 | |
486 | - post :join_not_logged, :profile => community.identifier | |
485 | + assert_equal community.identifier, @request.session[:join] | |
486 | + assert_redirected_to :controller => :account, :action => :login | |
487 | + end | |
487 | 488 | |
488 | - assert_redirected_to "/profile/#{community.identifier}/to_go" | |
489 | + should 'redirect to join after user logged asks to join_not_logged a community' do | |
490 | + community = Community.create!(:name => 'my test community') | |
491 | + | |
492 | + login_as(profile.identifier) | |
493 | + get :join_not_logged, :profile => community.identifier | |
489 | 494 | |
490 | - assert_nil @request.session[:previous_location] | |
495 | + assert_equal community.identifier, @request.session[:join] | |
496 | + assert_redirected_to :controller => :profile, :action => :join | |
491 | 497 | end |
492 | 498 | |
493 | 499 | should 'show number of published events in index' do |
... | ... | @@ -1272,15 +1278,6 @@ class ProfileControllerTest < ActionController::TestCase |
1272 | 1278 | assert_tag :tag => 'div', :content => /#{instance_eval(&plugin2.profile_tabs[:content])}/, :attributes => {:id => /#{plugin2.profile_tabs[:id]}/} |
1273 | 1279 | end |
1274 | 1280 | |
1275 | - should 'redirect to profile page when try to request join_not_logged via GET method' do | |
1276 | - community = Community.create!(:name => 'my test community') | |
1277 | - login_as(profile.identifier) | |
1278 | - get :join_not_logged, :profile => community.identifier | |
1279 | - assert_nothing_raised do | |
1280 | - assert_redirected_to community.url | |
1281 | - end | |
1282 | - end | |
1283 | - | |
1284 | 1281 | should 'check different profile from the domain profile' do |
1285 | 1282 | default = Environment.default |
1286 | 1283 | default.domains.create!(:name => 'environment.com') | ... | ... |