X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/03408b6294e0aa56d46823c1f44d47aaf69e226b..c38a50fc5f43a185dda39fd1aa235a2bda8ad83b:/test/controllers/user_blocks_controller_test.rb?ds=sidebyside diff --git a/test/controllers/user_blocks_controller_test.rb b/test/controllers/user_blocks_controller_test.rb index 7be619c2a..e5b0bdb32 100644 --- a/test/controllers/user_blocks_controller_test.rb +++ b/test/controllers/user_blocks_controller_test.rb @@ -73,6 +73,24 @@ class UserBlocksControllerTest < ActionController::TestCase end end + ## + # test the index action with multiple pages + def test_index_paged + create_list(:user_block, 50) + + get :index + assert_response :success + assert_select "table#block_list", :count => 1 do + assert_select "tr", :count => 21 + end + + get :index, :params => { :page => 2 } + assert_response :success + assert_select "table#block_list", :count => 1 do + assert_select "tr", :count => 21 + end + end + ## # test the show action def test_show @@ -421,6 +439,25 @@ class UserBlocksControllerTest < ActionController::TestCase end end + ## + # test the blocks_on action with multiple pages + def test_blocks_on_paged + user = create(:user) + create_list(:user_block, 50, :user => user) + + get :blocks_on, :params => { :display_name => user.display_name } + assert_response :success + assert_select "table#block_list", :count => 1 do + assert_select "tr", :count => 21 + end + + get :blocks_on, :params => { :display_name => user.display_name, :page => 2 } + assert_response :success + assert_select "table#block_list", :count => 1 do + assert_select "tr", :count => 21 + end + end + ## # test the blocks_by action def test_blocks_by @@ -465,4 +502,23 @@ class UserBlocksControllerTest < ActionController::TestCase assert_select "table#block_list", false assert_select "p", "#{normal_user.display_name} has not made any blocks yet." end + + ## + # test the blocks_by action with multiple pages + def test_blocks_by_paged + user = create(:moderator_user) + create_list(:user_block, 50, :creator => user) + + get :blocks_by, :params => { :display_name => user.display_name } + assert_response :success + assert_select "table#block_list", :count => 1 do + assert_select "tr", :count => 21 + end + + get :blocks_by, :params => { :display_name => user.display_name, :page => 2 } + assert_response :success + assert_select "table#block_list", :count => 1 do + assert_select "tr", :count => 21 + end + end end