]> git.openstreetmap.org Git - rails.git/blob - test/controllers/user_blocks/table_test_helper.rb
Merge remote-tracking branch 'upstream/pull/5455'
[rails.git] / test / controllers / user_blocks / table_test_helper.rb
1 module UserBlocks
2   module TableTestHelper
3     private
4
5     def check_user_blocks_table(user_blocks)
6       assert_dom "table#block_list tbody tr" do |rows|
7         assert_equal user_blocks.count, rows.count, "unexpected number of rows in user blocks table"
8         rows.zip(user_blocks).map do |row, user_block|
9           assert_dom row, "a[href='#{user_block_path user_block}']", 1
10         end
11       end
12     end
13
14     def check_no_page_link(name)
15       assert_select "a.page-link", { :text => /#{Regexp.quote(name)}/, :count => 0 }, "unexpected #{name} page link"
16     end
17
18     def check_page_link(name)
19       assert_select "a.page-link", { :text => /#{Regexp.quote(name)}/ }, "missing #{name} page link" do |buttons|
20         return buttons.first.attributes["href"].value
21       end
22     end
23   end
24 end