3 class UserBlocksControllerTest < ActionDispatch::IntegrationTest
5 # test all routes which lead to this controller
8 { :path => "/blocks/new/username", :method => :get },
9 { :controller => "user_blocks", :action => "new", :display_name => "username" }
13 { :path => "/user_blocks", :method => :get },
14 { :controller => "user_blocks", :action => "index" }
17 { :path => "/user_blocks/new", :method => :get },
18 { :controller => "user_blocks", :action => "new" }
21 { :path => "/user_blocks", :method => :post },
22 { :controller => "user_blocks", :action => "create" }
25 { :path => "/user_blocks/1", :method => :get },
26 { :controller => "user_blocks", :action => "show", :id => "1" }
29 { :path => "/user_blocks/1/edit", :method => :get },
30 { :controller => "user_blocks", :action => "edit", :id => "1" }
33 { :path => "/user_blocks/1", :method => :put },
34 { :controller => "user_blocks", :action => "update", :id => "1" }
37 { :path => "/user_blocks/1", :method => :delete },
38 { :controller => "user_blocks", :action => "destroy", :id => "1" }
41 { :path => "/blocks/1/revoke", :method => :get },
42 { :controller => "user_blocks", :action => "revoke", :id => "1" }
45 { :path => "/blocks/1/revoke", :method => :post },
46 { :controller => "user_blocks", :action => "revoke", :id => "1" }
50 { :path => "/user/username/blocks", :method => :get },
51 { :controller => "user_blocks", :action => "blocks_on", :display_name => "username" }
54 { :path => "/user/username/blocks_by", :method => :get },
55 { :controller => "user_blocks", :action => "blocks_by", :display_name => "username" }
58 { :path => "/user/username/blocks/revoke_all", :method => :get },
59 { :controller => "user_blocks", :action => "revoke_all", :display_name => "username" }
62 { :path => "/user/username/blocks/revoke_all", :method => :post },
63 { :controller => "user_blocks", :action => "revoke_all", :display_name => "username" }
68 # test the index action
70 revoked_block = create(:user_block, :revoked)
73 assert_response :success
74 assert_select "table#block_list tbody tr", :count => 1 do
75 assert_select "a[href='#{user_path revoked_block.user}']", :text => revoked_block.user.display_name
76 assert_select "a[href='#{user_path revoked_block.creator}']", :text => revoked_block.creator.display_name
77 assert_select "a[href='#{user_path revoked_block.revoker}']", :text => revoked_block.revoker.display_name
80 active_block = create(:user_block)
81 expired_block = create(:user_block, :expired)
84 assert_response :success
85 assert_select "table#block_list tbody", :count => 1 do
87 assert_select "a[href='#{user_block_path(active_block)}']", 1
88 assert_select "a[href='#{user_block_path(expired_block)}']", 1
89 assert_select "a[href='#{user_block_path(revoked_block)}']", 1
94 # test the index action with multiple pages
96 user_blocks = create_list(:user_block, 50).reverse
97 next_path = user_blocks_path
100 assert_response :success
101 check_user_blocks_table user_blocks[0...20]
102 check_no_page_link "Newer Blocks"
103 next_path = check_page_link "Older Blocks"
106 assert_response :success
107 check_user_blocks_table user_blocks[20...40]
108 check_page_link "Newer Blocks"
109 next_path = check_page_link "Older Blocks"
112 assert_response :success
113 check_user_blocks_table user_blocks[40...50]
114 check_page_link "Newer Blocks"
115 check_no_page_link "Older Blocks"
119 # test the index action with invalid pages
120 def test_index_invalid_paged
121 %w[-1 0 fred].each do |id|
122 get user_blocks_path(:before => id)
123 assert_redirected_to :controller => :errors, :action => :bad_request
125 get user_blocks_path(:after => id)
126 assert_redirected_to :controller => :errors, :action => :bad_request
131 # test the show action
133 active_block = create(:user_block, :needs_view)
134 expired_block = create(:user_block, :expired)
135 revoked_block = create(:user_block, :revoked)
137 # Viewing a block should fail when a bogus ID is given
138 get user_block_path(:id => 99999)
139 assert_response :not_found
140 assert_template "not_found"
141 assert_select "p", "Sorry, the user block with ID 99999 could not be found."
143 # Viewing an expired block should work
144 get user_block_path(:id => expired_block)
145 assert_response :success
146 assert_select "h1 a[href='#{user_path expired_block.user}']", :text => expired_block.user.display_name
147 assert_select "h1 a[href='#{user_path expired_block.creator}']", :text => expired_block.creator.display_name
149 # Viewing a revoked block should work
150 get user_block_path(:id => revoked_block)
151 assert_response :success
152 assert_select "h1 a[href='#{user_path revoked_block.user}']", :text => revoked_block.user.display_name
153 assert_select "h1 a[href='#{user_path revoked_block.creator}']", :text => revoked_block.creator.display_name
154 assert_select "a[href='#{user_path revoked_block.revoker}']", :text => revoked_block.revoker.display_name
156 # Viewing an active block should work, but shouldn't mark it as seen
157 get user_block_path(:id => active_block)
158 assert_response :success
159 assert_select "h1 a[href='#{user_path active_block.user}']", :text => active_block.user.display_name
160 assert_select "h1 a[href='#{user_path active_block.creator}']", :text => active_block.creator.display_name
161 assert UserBlock.find(active_block.id).needs_view
163 # Login as the blocked user
164 session_for(active_block.user)
166 # Now viewing it should mark it as seen
167 get user_block_path(:id => active_block)
168 assert_response :success
169 assert_not UserBlock.find(active_block.id).needs_view
173 # test the new action
175 target_user = create(:user)
177 # Check that the block creation page requires us to login
178 get new_user_block_path(target_user)
179 assert_redirected_to login_path(:referer => new_user_block_path(target_user))
181 # Login as a normal user
182 session_for(create(:user))
184 # Check that normal users can't load the block creation page
185 get new_user_block_path(target_user)
186 assert_redirected_to :controller => "errors", :action => "forbidden"
188 # Login as a moderator
189 session_for(create(:moderator_user))
191 # Check that the block creation page loads for moderators
192 get new_user_block_path(target_user)
193 assert_response :success
194 assert_select "h1 a[href='#{user_path target_user}']", :text => target_user.display_name
195 assert_select "form#new_user_block", :count => 1 do
196 assert_select "textarea#user_block_reason", :count => 1
197 assert_select "select#user_block_period", :count => 1
198 assert_select "input#user_block_needs_view[type='checkbox']", :count => 1
199 assert_select "input#display_name[type='hidden']", :count => 1
200 assert_select "input[type='submit'][value='Create block']", :count => 1
203 # We should get an error if the user doesn't exist
204 get new_user_block_path(:display_name => "non_existent_user")
205 assert_response :not_found
206 assert_template "users/no_such_user"
207 assert_select "h1", "The user non_existent_user does not exist"
211 # test the edit action
213 active_block = create(:user_block)
215 # Check that the block edit page requires us to login
216 get edit_user_block_path(:id => active_block)
217 assert_redirected_to login_path(:referer => edit_user_block_path(active_block))
219 # Login as a normal user
220 session_for(create(:user))
222 # Check that normal users can't load the block edit page
223 get edit_user_block_path(:id => active_block)
224 assert_redirected_to :controller => "errors", :action => "forbidden"
226 # Login as a moderator
227 session_for(create(:moderator_user))
229 # Check that the block edit page loads for moderators
230 get edit_user_block_path(:id => active_block)
231 assert_response :success
232 assert_select "h1 a[href='#{user_path active_block.user}']", :text => active_block.user.display_name
233 assert_select "form#edit_user_block_#{active_block.id}", :count => 1 do
234 assert_select "textarea#user_block_reason", :count => 1
235 assert_select "select#user_block_period", :count => 1
236 assert_select "input#user_block_needs_view[type='checkbox']", :count => 1
237 assert_select "input[type='submit'][value='Update block']", :count => 1
240 # We should get an error if the user doesn't exist
241 get edit_user_block_path(:id => 99999)
242 assert_response :not_found
243 assert_template "not_found"
244 assert_select "p", "Sorry, the user block with ID 99999 could not be found."
248 # test the edit action when the remaining block duration doesn't match the available select options
249 def test_edit_duration
250 moderator_user = create(:moderator_user)
253 active_block = create(:user_block, :creator => moderator_user, :ends_at => Time.now.utc + 96.hours)
255 session_for(moderator_user)
256 get edit_user_block_path(active_block)
258 assert_select "form#edit_user_block_#{active_block.id}", :count => 1 do
259 assert_select "select#user_block_period", :count => 1 do
260 assert_select "option[value='96'][selected]", :count => 1
265 get edit_user_block_path(active_block)
267 assert_select "form#edit_user_block_#{active_block.id}", :count => 1 do
268 assert_select "select#user_block_period", :count => 1 do
269 assert_select "option[value='96'][selected]", :count => 1
276 # test the create action
278 target_user = create(:user)
279 moderator_user = create(:moderator_user)
281 # Not logged in yet, so creating a block should fail
282 post user_blocks_path
283 assert_response :forbidden
285 # Login as a normal user
286 session_for(create(:user))
288 # Check that normal users can't create blocks
289 post user_blocks_path
290 assert_redirected_to :controller => "errors", :action => "forbidden"
292 # Login as a moderator
293 session_for(moderator_user)
295 # A bogus block period should result in an error
296 assert_no_difference "UserBlock.count" do
297 post user_blocks_path(:display_name => target_user.display_name,
298 :user_block_period => "99")
300 assert_redirected_to new_user_block_path(target_user)
301 assert_equal "The blocking period must be one of the values selectable in the drop-down list.", flash[:error]
303 # Check that creating a block works
304 assert_difference "UserBlock.count", 1 do
305 post user_blocks_path(:display_name => target_user.display_name,
306 :user_block_period => "12",
307 :user_block => { :needs_view => false, :reason => "Vandalism" })
309 id = UserBlock.order(:id).ids.last
310 assert_redirected_to user_block_path(:id => id)
311 assert_equal "Created a block on user #{target_user.display_name}.", flash[:notice]
312 b = UserBlock.find(id)
313 assert_in_delta Time.now.utc, b.created_at, 1
314 assert_in_delta Time.now.utc, b.updated_at, 1
315 assert_in_delta Time.now.utc + 12.hours, b.ends_at, 1
316 assert_not b.needs_view
317 assert_equal "Vandalism", b.reason
318 assert_equal "markdown", b.reason_format
319 assert_equal moderator_user.id, b.creator_id
321 # We should get an error if no user is specified
322 post user_blocks_path
323 assert_response :not_found
324 assert_template "users/no_such_user"
325 assert_select "h1", "The user does not exist"
327 # We should get an error if the user doesn't exist
328 post user_blocks_path(:display_name => "non_existent_user")
329 assert_response :not_found
330 assert_template "users/no_such_user"
331 assert_select "h1", "The user non_existent_user does not exist"
335 # test the duration of a created block
336 def test_create_duration
337 target_user = create(:user)
338 moderator_user = create(:moderator_user)
340 session_for(moderator_user)
341 post user_blocks_path(:display_name => target_user.display_name,
342 :user_block_period => "336",
343 :user_block => { :needs_view => false, :reason => "Vandalism" })
345 block = UserBlock.order(:id).last
346 assert_equal 1209600, block.ends_at - block.created_at
350 # test the update action
352 moderator_user = create(:moderator_user)
353 second_moderator_user = create(:moderator_user)
354 active_block = create(:user_block, :creator => moderator_user)
356 # Not logged in yet, so updating a block should fail
357 put user_block_path(:id => active_block)
358 assert_response :forbidden
360 # Login as a normal user
361 session_for(create(:user))
363 # Check that normal users can't update blocks
364 put user_block_path(:id => active_block)
365 assert_redirected_to :controller => "errors", :action => "forbidden"
367 # Login as the wrong moderator
368 session_for(second_moderator_user)
370 # Check that only the person who created a block can update it
371 assert_no_difference "UserBlock.count" do
372 put user_block_path(:id => active_block,
373 :user_block_period => "12",
374 :user_block => { :needs_view => true, :reason => "Vandalism" })
376 assert_redirected_to edit_user_block_path(active_block)
377 assert_equal "Only the moderator who created this block can edit it.", flash[:error]
379 # Login as the correct moderator
380 session_for(moderator_user)
382 # A bogus block period should result in an error
383 assert_no_difference "UserBlock.count" do
384 put user_block_path(:id => active_block, :user_block_period => "99")
386 assert_redirected_to edit_user_block_path(active_block)
387 assert_equal "The blocking period must be one of the values selectable in the drop-down list.", flash[:error]
389 # Check that updating a block works
390 assert_no_difference "UserBlock.count" do
391 put user_block_path(:id => active_block,
392 :user_block_period => "12",
393 :user_block => { :needs_view => true, :reason => "Vandalism" })
395 assert_redirected_to user_block_path(active_block)
396 assert_equal "Block updated.", flash[:notice]
397 b = UserBlock.find(active_block.id)
398 assert_in_delta Time.now.utc, b.updated_at, 1
400 assert_equal "Vandalism", b.reason
402 # We should get an error if the block doesn't exist
403 put user_block_path(:id => 99999)
404 assert_response :not_found
405 assert_template "not_found"
406 assert_select "p", "Sorry, the user block with ID 99999 could not be found."
410 # test the update action on expired blocks
411 def test_update_expired
412 creator_user = create(:moderator_user)
413 other_moderator_user = create(:moderator_user)
414 block = create(:user_block, :expired, :creator => creator_user, :reason => "Original Reason")
416 session_for(other_moderator_user)
417 put user_block_path(block,
418 :user_block_period => "0",
419 :user_block => { :needs_view => false, :reason => "Updated Reason" })
420 assert_redirected_to edit_user_block_path(block)
421 assert_equal "Only the moderator who created this block can edit it.", flash[:error]
423 assert_not block.active?
424 assert_equal "Original Reason", block.reason
426 session_for(creator_user)
427 put user_block_path(block,
428 :user_block_period => "0",
429 :user_block => { :needs_view => false, :reason => "Updated Reason" })
430 assert_redirected_to user_block_path(block)
431 assert_equal "Block updated.", flash[:notice]
433 assert_not block.active?
434 assert_equal "Updated Reason", block.reason
436 put user_block_path(block,
437 :user_block_period => "0",
438 :user_block => { :needs_view => true, :reason => "Updated Reason 2" })
439 assert_redirected_to user_block_path(block)
440 assert_equal "Block updated.", flash[:notice]
442 assert_predicate block, :active?
443 assert_equal "Updated Reason 2", block.reason
447 # test the revoke action
449 active_block = create(:user_block)
451 # Check that the block revoke page requires us to login
452 get revoke_user_block_path(:id => active_block)
453 assert_redirected_to login_path(:referer => revoke_user_block_path(:id => active_block))
455 # Login as a normal user
456 session_for(create(:user))
458 # Check that normal users can't load the block revoke page
459 get revoke_user_block_path(:id => active_block)
460 assert_redirected_to :controller => "errors", :action => "forbidden"
462 # Login as a moderator
463 session_for(create(:moderator_user))
465 # Check that the block revoke page loads for moderators
466 get revoke_user_block_path(:id => active_block)
467 assert_response :success
468 assert_template "revoke"
469 assert_select "h1 a[href='#{user_path active_block.user}']", :text => active_block.user.display_name
470 assert_select "form", :count => 1 do
471 assert_select "input#confirm[type='checkbox']", :count => 1
472 assert_select "input[type='submit'][value='Revoke!']", :count => 1
475 # Check that revoking a block using GET should fail
476 get revoke_user_block_path(:id => active_block, :confirm => true)
477 assert_response :success
478 assert_template "revoke"
479 b = UserBlock.find(active_block.id)
480 assert_operator b.ends_at - Time.now.utc, :>, 100
482 # Check that revoking a block works using POST
483 post revoke_user_block_path(:id => active_block, :confirm => true)
484 assert_redirected_to user_block_path(active_block)
485 b = UserBlock.find(active_block.id)
486 assert_in_delta Time.now.utc, b.ends_at, 1
488 # We should get an error if the block doesn't exist
489 get revoke_user_block_path(:id => 99999)
490 assert_response :not_found
491 assert_template "not_found"
492 assert_select "p", "Sorry, the user block with ID 99999 could not be found."
496 # test the revoke all page
497 def test_revoke_all_page
498 blocked_user = create(:user)
499 create(:user_block, :user => blocked_user)
501 # Asking for the revoke all blocks page with a bogus user name should fail
502 get user_blocks_on_path("non_existent_user")
503 assert_response :not_found
505 # Check that the revoke all blocks page requires us to login
506 get revoke_all_user_blocks_path(blocked_user)
507 assert_redirected_to login_path(:referer => revoke_all_user_blocks_path(blocked_user))
509 # Login as a normal user
510 session_for(create(:user))
512 # Check that normal users can't load the revoke all blocks page
513 get revoke_all_user_blocks_path(blocked_user)
514 assert_redirected_to :controller => "errors", :action => "forbidden"
516 # Login as a moderator
517 session_for(create(:moderator_user))
519 # Check that the revoke all blocks page loads for moderators
520 get revoke_all_user_blocks_path(blocked_user)
521 assert_response :success
522 assert_select "h1 a[href='#{user_path blocked_user}']", :text => blocked_user.display_name
526 # test the revoke all action
527 def test_revoke_all_action
528 blocked_user = create(:user)
529 active_block1 = create(:user_block, :user => blocked_user)
530 active_block2 = create(:user_block, :user => blocked_user)
531 expired_block1 = create(:user_block, :expired, :user => blocked_user)
532 blocks = [active_block1, active_block2, expired_block1]
533 moderator_user = create(:moderator_user)
535 assert_predicate active_block1, :active?
536 assert_predicate active_block2, :active?
537 assert_not_predicate expired_block1, :active?
539 # Login as a normal user
540 session_for(create(:user))
542 # Check that normal users can't load the block revoke page
543 get revoke_all_user_blocks_path(:blocked_user)
544 assert_redirected_to :controller => "errors", :action => "forbidden"
546 # Login as a moderator
547 session_for(moderator_user)
549 # Check that revoking blocks using GET should fail
550 get revoke_all_user_blocks_path(blocked_user, :confirm => true)
551 assert_response :success
552 assert_template "revoke_all"
554 blocks.each(&:reload)
555 assert_predicate active_block1, :active?
556 assert_predicate active_block2, :active?
557 assert_not_predicate expired_block1, :active?
559 # Check that revoking blocks works using POST
560 post revoke_all_user_blocks_path(blocked_user, :confirm => true)
561 assert_redirected_to user_blocks_on_path(blocked_user)
563 blocks.each(&:reload)
564 assert_not_predicate active_block1, :active?
565 assert_not_predicate active_block2, :active?
566 assert_not_predicate expired_block1, :active?
567 assert_equal moderator_user, active_block1.revoker
568 assert_equal moderator_user, active_block2.revoker
569 assert_not_equal moderator_user, expired_block1.revoker
573 # test the blocks_on action
575 blocked_user = create(:user)
576 unblocked_user = create(:user)
577 normal_user = create(:user)
578 active_block = create(:user_block, :user => blocked_user)
579 revoked_block = create(:user_block, :revoked, :user => blocked_user)
580 expired_block = create(:user_block, :expired, :user => unblocked_user)
582 # Asking for a list of blocks with a bogus user name should fail
583 get user_blocks_on_path("non_existent_user")
584 assert_response :not_found
585 assert_template "users/no_such_user"
586 assert_select "h1", "The user non_existent_user does not exist"
588 # Check the list of blocks for a user that has never been blocked
589 get user_blocks_on_path(normal_user)
590 assert_response :success
591 assert_select "table#block_list", false
592 assert_select "p", "#{normal_user.display_name} has not been blocked yet."
594 # Check the list of blocks for a user that is currently blocked
595 get user_blocks_on_path(blocked_user)
596 assert_response :success
597 assert_select "h1 a[href='#{user_path blocked_user}']", :text => blocked_user.display_name
598 assert_select "table#block_list tbody", :count => 1 do
599 assert_select "tr", 2
600 assert_select "a[href='#{user_block_path(active_block)}']", 1
601 assert_select "a[href='#{user_block_path(revoked_block)}']", 1
604 # Check the list of blocks for a user that has previously been blocked
605 get user_blocks_on_path(unblocked_user)
606 assert_response :success
607 assert_select "h1 a[href='#{user_path unblocked_user}']", :text => unblocked_user.display_name
608 assert_select "table#block_list tbody", :count => 1 do
609 assert_select "tr", 1
610 assert_select "a[href='#{user_block_path(expired_block)}']", 1
615 # test the blocks_on action with multiple pages
616 def test_blocks_on_paged
618 user_blocks = create_list(:user_block, 50, :user => user).reverse
619 next_path = user_blocks_on_path(user)
622 assert_response :success
623 check_user_blocks_table user_blocks[0...20]
624 check_no_page_link "Newer Blocks"
625 next_path = check_page_link "Older Blocks"
628 assert_response :success
629 check_user_blocks_table user_blocks[20...40]
630 check_page_link "Newer Blocks"
631 next_path = check_page_link "Older Blocks"
634 assert_response :success
635 check_user_blocks_table user_blocks[40...50]
636 check_page_link "Newer Blocks"
637 check_no_page_link "Older Blocks"
641 # test the blocks_on action with invalid pages
642 def test_blocks_on_invalid_paged
645 %w[-1 0 fred].each do |id|
646 get user_blocks_on_path(user, :before => id)
647 assert_redirected_to :controller => :errors, :action => :bad_request
649 get user_blocks_on_path(user, :after => id)
650 assert_redirected_to :controller => :errors, :action => :bad_request
655 # test the blocks_by action
657 moderator_user = create(:moderator_user)
658 second_moderator_user = create(:moderator_user)
659 normal_user = create(:user)
660 active_block = create(:user_block, :creator => moderator_user)
661 expired_block = create(:user_block, :expired, :creator => second_moderator_user)
662 revoked_block = create(:user_block, :revoked, :creator => second_moderator_user)
664 # Asking for a list of blocks with a bogus user name should fail
665 get user_blocks_by_path("non_existent_user")
666 assert_response :not_found
667 assert_template "users/no_such_user"
668 assert_select "h1", "The user non_existent_user does not exist"
670 # Check the list of blocks given by one moderator
671 get user_blocks_by_path(moderator_user)
672 assert_response :success
673 assert_select "h1 a[href='#{user_path moderator_user}']", :text => moderator_user.display_name
674 assert_select "table#block_list tbody", :count => 1 do
675 assert_select "tr", 1
676 assert_select "a[href='#{user_block_path(active_block)}']", 1
679 # Check the list of blocks given by a different moderator
680 get user_blocks_by_path(second_moderator_user)
681 assert_response :success
682 assert_select "h1 a[href='#{user_path second_moderator_user}']", :text => second_moderator_user.display_name
683 assert_select "table#block_list tbody", :count => 1 do
684 assert_select "tr", 2
685 assert_select "a[href='#{user_block_path(expired_block)}']", 1
686 assert_select "a[href='#{user_block_path(revoked_block)}']", 1
689 # Check the list of blocks (not) given by a normal user
690 get user_blocks_by_path(normal_user)
691 assert_response :success
692 assert_select "table#block_list", false
693 assert_select "p", "#{normal_user.display_name} has not made any blocks yet."
697 # test the blocks_by action with multiple pages
698 def test_blocks_by_paged
699 user = create(:moderator_user)
700 user_blocks = create_list(:user_block, 50, :creator => user).reverse
701 next_path = user_blocks_by_path(user)
704 assert_response :success
705 check_user_blocks_table user_blocks[0...20]
706 check_no_page_link "Newer Blocks"
707 next_path = check_page_link "Older Blocks"
710 assert_response :success
711 check_user_blocks_table user_blocks[20...40]
712 check_page_link "Newer Blocks"
713 next_path = check_page_link "Older Blocks"
716 assert_response :success
717 check_user_blocks_table user_blocks[40...50]
718 check_page_link "Newer Blocks"
719 check_no_page_link "Older Blocks"
723 # test the blocks_by action with invalid pages
724 def test_blocks_by_invalid_paged
725 user = create(:moderator_user)
727 %w[-1 0 fred].each do |id|
728 get user_blocks_by_path(user, :before => id)
729 assert_redirected_to :controller => :errors, :action => :bad_request
731 get user_blocks_by_path(user, :after => id)
732 assert_redirected_to :controller => :errors, :action => :bad_request
738 def check_user_blocks_table(user_blocks)
739 assert_dom "table#block_list tbody tr" do |rows|
740 assert_equal user_blocks.count, rows.count, "unexpected number of rows in user blocks table"
741 rows.zip(user_blocks).map do |row, user_block|
742 assert_dom row, "a[href='#{user_block_path user_block}']", 1
747 def check_no_page_link(name)
748 assert_select "a.page-link", { :text => /#{Regexp.quote(name)}/, :count => 0 }, "unexpected #{name} page link"
751 def check_page_link(name)
752 assert_select "a.page-link", { :text => /#{Regexp.quote(name)}/ }, "missing #{name} page link" do |buttons|
753 return buttons.first.attributes["href"].value