Rename user#list to user#index
This commit is contained in:
parent
5a2d2f97ce
commit
a3606e00b4
6 changed files with 40 additions and 40 deletions
|
@ -170,19 +170,19 @@ class UserControllerTest < ActionController::TestCase
|
|||
|
||||
assert_routing(
|
||||
{ :path => "/users", :method => :get },
|
||||
{ :controller => "user", :action => "list" }
|
||||
{ :controller => "user", :action => "index" }
|
||||
)
|
||||
assert_routing(
|
||||
{ :path => "/users", :method => :post },
|
||||
{ :controller => "user", :action => "list" }
|
||||
{ :controller => "user", :action => "index" }
|
||||
)
|
||||
assert_routing(
|
||||
{ :path => "/users/status", :method => :get },
|
||||
{ :controller => "user", :action => "list", :status => "status" }
|
||||
{ :controller => "user", :action => "index", :status => "status" }
|
||||
)
|
||||
assert_routing(
|
||||
{ :path => "/users/status", :method => :post },
|
||||
{ :controller => "user", :action => "list", :status => "status" }
|
||||
{ :controller => "user", :action => "index", :status => "status" }
|
||||
)
|
||||
end
|
||||
|
||||
|
@ -1431,7 +1431,7 @@ class UserControllerTest < ActionController::TestCase
|
|||
assert_equal "deleted", user.status
|
||||
end
|
||||
|
||||
def test_list_get
|
||||
def test_index_get
|
||||
user = create(:user)
|
||||
moderator_user = create(:moderator_user)
|
||||
administrator_user = create(:administrator_user)
|
||||
|
@ -1443,21 +1443,21 @@ class UserControllerTest < ActionController::TestCase
|
|||
assert_equal 7, User.count
|
||||
|
||||
# Shouldn't work when not logged in
|
||||
get :list
|
||||
get :index
|
||||
assert_response :redirect
|
||||
assert_redirected_to :action => :login, :referer => users_path
|
||||
|
||||
session[:user] = user.id
|
||||
|
||||
# Shouldn't work when logged in as a normal user
|
||||
get :list
|
||||
get :index
|
||||
assert_response :redirect
|
||||
assert_redirected_to :action => :login, :referer => users_path
|
||||
|
||||
session[:user] = moderator_user.id
|
||||
|
||||
# Shouldn't work when logged in as a moderator
|
||||
get :list
|
||||
get :index
|
||||
assert_response :redirect
|
||||
assert_redirected_to :action => :login, :referer => users_path
|
||||
|
||||
|
@ -1465,25 +1465,25 @@ class UserControllerTest < ActionController::TestCase
|
|||
|
||||
# Note there is a header row, so all row counts are users + 1
|
||||
# Should work when logged in as an administrator
|
||||
get :list
|
||||
get :index
|
||||
assert_response :success
|
||||
assert_template :list
|
||||
assert_template :index
|
||||
assert_select "table#user_list tr", :count => 7 + 1
|
||||
|
||||
# Should be able to limit by status
|
||||
get :list, :params => { :status => "suspended" }
|
||||
get :index, :params => { :status => "suspended" }
|
||||
assert_response :success
|
||||
assert_template :list
|
||||
assert_template :index
|
||||
assert_select "table#user_list tr", :count => 1 + 1
|
||||
|
||||
# Should be able to limit by IP address
|
||||
get :list, :params => { :ip => "1.2.3.4" }
|
||||
get :index, :params => { :ip => "1.2.3.4" }
|
||||
assert_response :success
|
||||
assert_template :list
|
||||
assert_template :index
|
||||
assert_select "table#user_list tr", :count => 1 + 1
|
||||
end
|
||||
|
||||
def test_list_get_paginated
|
||||
def test_index_get_paginated
|
||||
1.upto(100).each do |n|
|
||||
User.create(:display_name => "extra_#{n}",
|
||||
:email => "extra#{n}@example.com",
|
||||
|
@ -1495,29 +1495,29 @@ class UserControllerTest < ActionController::TestCase
|
|||
# 100 examples, an administrator, and a granter for the admin.
|
||||
assert_equal 102, User.count
|
||||
|
||||
get :list
|
||||
get :index
|
||||
assert_response :success
|
||||
assert_template :list
|
||||
assert_template :index
|
||||
assert_select "table#user_list tr", :count => 51
|
||||
|
||||
get :list, :params => { :page => 2 }
|
||||
get :index, :params => { :page => 2 }
|
||||
assert_response :success
|
||||
assert_template :list
|
||||
assert_template :index
|
||||
assert_select "table#user_list tr", :count => 51
|
||||
|
||||
get :list, :params => { :page => 3 }
|
||||
get :index, :params => { :page => 3 }
|
||||
assert_response :success
|
||||
assert_template :list
|
||||
assert_template :index
|
||||
assert_select "table#user_list tr", :count => 3
|
||||
end
|
||||
|
||||
def test_list_post_confirm
|
||||
def test_index_post_confirm
|
||||
inactive_user = create(:user, :pending)
|
||||
suspended_user = create(:user, :suspended)
|
||||
|
||||
# Shouldn't work when not logged in
|
||||
assert_no_difference "User.active.count" do
|
||||
post :list, :params => { :confirm => 1, :user => { inactive_user.id => 1, suspended_user.id => 1 } }
|
||||
post :index, :params => { :confirm => 1, :user => { inactive_user.id => 1, suspended_user.id => 1 } }
|
||||
end
|
||||
assert_response :redirect
|
||||
assert_redirected_to :action => :login, :referer => users_path
|
||||
|
@ -1528,7 +1528,7 @@ class UserControllerTest < ActionController::TestCase
|
|||
|
||||
# Shouldn't work when logged in as a normal user
|
||||
assert_no_difference "User.active.count" do
|
||||
post :list, :params => { :confirm => 1, :user => { inactive_user.id => 1, suspended_user.id => 1 } }
|
||||
post :index, :params => { :confirm => 1, :user => { inactive_user.id => 1, suspended_user.id => 1 } }
|
||||
end
|
||||
assert_response :redirect
|
||||
assert_redirected_to :action => :login, :referer => users_path
|
||||
|
@ -1539,7 +1539,7 @@ class UserControllerTest < ActionController::TestCase
|
|||
|
||||
# Shouldn't work when logged in as a moderator
|
||||
assert_no_difference "User.active.count" do
|
||||
post :list, :params => { :confirm => 1, :user => { inactive_user.id => 1, suspended_user.id => 1 } }
|
||||
post :index, :params => { :confirm => 1, :user => { inactive_user.id => 1, suspended_user.id => 1 } }
|
||||
end
|
||||
assert_response :redirect
|
||||
assert_redirected_to :action => :login, :referer => users_path
|
||||
|
@ -1550,21 +1550,21 @@ class UserControllerTest < ActionController::TestCase
|
|||
|
||||
# Should work when logged in as an administrator
|
||||
assert_difference "User.active.count", 2 do
|
||||
post :list, :params => { :confirm => 1, :user => { inactive_user.id => 1, suspended_user.id => 1 } }
|
||||
post :index, :params => { :confirm => 1, :user => { inactive_user.id => 1, suspended_user.id => 1 } }
|
||||
end
|
||||
assert_response :redirect
|
||||
assert_redirected_to :action => :list
|
||||
assert_redirected_to :action => :index
|
||||
assert_equal "confirmed", inactive_user.reload.status
|
||||
assert_equal "confirmed", suspended_user.reload.status
|
||||
end
|
||||
|
||||
def test_list_post_hide
|
||||
def test_index_post_hide
|
||||
normal_user = create(:user)
|
||||
confirmed_user = create(:user, :confirmed)
|
||||
|
||||
# Shouldn't work when not logged in
|
||||
assert_no_difference "User.active.count" do
|
||||
post :list, :params => { :hide => 1, :user => { normal_user.id => 1, confirmed_user.id => 1 } }
|
||||
post :index, :params => { :hide => 1, :user => { normal_user.id => 1, confirmed_user.id => 1 } }
|
||||
end
|
||||
assert_response :redirect
|
||||
assert_redirected_to :action => :login, :referer => users_path
|
||||
|
@ -1575,7 +1575,7 @@ class UserControllerTest < ActionController::TestCase
|
|||
|
||||
# Shouldn't work when logged in as a normal user
|
||||
assert_no_difference "User.active.count" do
|
||||
post :list, :params => { :hide => 1, :user => { normal_user.id => 1, confirmed_user.id => 1 } }
|
||||
post :index, :params => { :hide => 1, :user => { normal_user.id => 1, confirmed_user.id => 1 } }
|
||||
end
|
||||
assert_response :redirect
|
||||
assert_redirected_to :action => :login, :referer => users_path
|
||||
|
@ -1586,7 +1586,7 @@ class UserControllerTest < ActionController::TestCase
|
|||
|
||||
# Shouldn't work when logged in as a moderator
|
||||
assert_no_difference "User.active.count" do
|
||||
post :list, :params => { :hide => 1, :user => { normal_user.id => 1, confirmed_user.id => 1 } }
|
||||
post :index, :params => { :hide => 1, :user => { normal_user.id => 1, confirmed_user.id => 1 } }
|
||||
end
|
||||
assert_response :redirect
|
||||
assert_redirected_to :action => :login, :referer => users_path
|
||||
|
@ -1597,10 +1597,10 @@ class UserControllerTest < ActionController::TestCase
|
|||
|
||||
# Should work when logged in as an administrator
|
||||
assert_difference "User.active.count", -2 do
|
||||
post :list, :params => { :hide => 1, :user => { normal_user.id => 1, confirmed_user.id => 1 } }
|
||||
post :index, :params => { :hide => 1, :user => { normal_user.id => 1, confirmed_user.id => 1 } }
|
||||
end
|
||||
assert_response :redirect
|
||||
assert_redirected_to :action => :list
|
||||
assert_redirected_to :action => :index
|
||||
assert_equal "deleted", normal_user.reload.status
|
||||
assert_equal "deleted", confirmed_user.reload.status
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue