tests: fix rails 2.7 keyword parameter deprecation warnings.
This commit is contained in:
@@ -258,8 +258,8 @@ module ApplicationHelper
|
||||
simple_form_for(model, **options, &block)
|
||||
end
|
||||
|
||||
def table_for(*args, **options, &block)
|
||||
table = TableBuilder.new(*args, **options, &block)
|
||||
def table_for(...)
|
||||
table = TableBuilder.new(...)
|
||||
render "table_builder/table", table: table
|
||||
end
|
||||
|
||||
|
||||
@@ -13,10 +13,10 @@ module PaginationExtension
|
||||
@paginator_count = 1_000_000
|
||||
end
|
||||
|
||||
if page =~ /\Ab(\d+)\z/i
|
||||
if page.to_s =~ /\Ab(\d+)\z/i
|
||||
@paginator_mode = :sequential_before
|
||||
paginate_sequential_before($1, records_per_page)
|
||||
elsif page =~ /\Aa(\d+)\z/i
|
||||
elsif page.to_s =~ /\Aa(\d+)\z/i
|
||||
@paginator_mode = :sequential_after
|
||||
paginate_sequential_after($1, records_per_page)
|
||||
else
|
||||
|
||||
@@ -49,8 +49,8 @@ class TableBuilder
|
||||
yield self if block_given?
|
||||
end
|
||||
|
||||
def column(*args, **options, &block)
|
||||
@columns << Column.new(*args, **options, &block)
|
||||
def column(...)
|
||||
@columns << Column.new(...)
|
||||
end
|
||||
|
||||
def all_row_attributes(item, i)
|
||||
|
||||
@@ -25,7 +25,7 @@ class PostPresenter
|
||||
|
||||
locals[:article_attrs] = {
|
||||
"id" => "post_#{post.id}",
|
||||
"class" => preview_class(post, options).join(" ")
|
||||
"class" => preview_class(post, **options).join(" ")
|
||||
}.merge(data_attributes(post))
|
||||
|
||||
locals[:link_target] = options[:link_target] || post
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<div id="p-<%= listing_type(:artist_id) %>-listing">
|
||||
|
||||
<%= table_for @artist_versions, {class: "striped autofit", width: "100%"} do |t| %>
|
||||
<%= table_for @artist_versions, class: "striped autofit", width: "100%" do |t| %>
|
||||
<% t.column "Name", td: {class: "diff-body"} do |artist_version| %>
|
||||
<%= link_to artist_version.name, artist_path(artist_version.artist_id) %>
|
||||
<%= link_to "»", artist_versions_path(search: {artist_id: artist_version.artist_id}, anchor: "artist-version-#{artist_version.id}") %>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<div id="a-index">
|
||||
<%= render "search" %>
|
||||
|
||||
<%= table_for @artists, {class: "striped autofit"} do |t| %>
|
||||
<%= table_for @artists, class: "striped autofit" do |t| %>
|
||||
<% t.column "Name" do |artist| %>
|
||||
<%= link_to artist.name, artist, class: "tag-type-#{Tag.categories.artist}" %>
|
||||
<span class="post-count"><%= artist.tag.try(:post_count) || 0 %></span>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
<%= render "search" %>
|
||||
|
||||
<%= table_for @bans, {class: "striped autofit"} do |t| %>
|
||||
<%= table_for @bans, class: "striped autofit" do |t| %>
|
||||
<% t.column "Banned User" do |ban| %>
|
||||
<%= link_to_user(ban.user) %>
|
||||
<%= link_to "»", bans_path(search: search_params.merge(user_name: ban.user.name)) %>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<%= f.submit "Search" %>
|
||||
<% end %>
|
||||
|
||||
<%= table_for @comment_votes, {class: "striped autofit"} do |t| %>
|
||||
<%= table_for @comment_votes, class: "striped autofit" do |t| %>
|
||||
<% t.column "Post" do |vote| %>
|
||||
<%= PostPresenter.preview(vote.comment.post, show_deleted: true) %>
|
||||
<% end %>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<div id="a-index">
|
||||
<h1>Delayed Jobs</h1>
|
||||
|
||||
<%= table_for @delayed_jobs, {class: "striped autofit"} do |t| %>
|
||||
<%= table_for @delayed_jobs, class: "striped autofit" do |t| %>
|
||||
<% t.column :queue %>
|
||||
<% t.column "Name" do |job| %>
|
||||
<%= raw print_name(job) %>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<% end %>
|
||||
|
||||
<%= table_for @favorite_groups, width: "100%" do |t| %>
|
||||
<% t.column "Name", {width: "60%"} do |favgroup| %>
|
||||
<% t.column "Name", width: "60%" do |favgroup| %>
|
||||
<%= link_to favgroup.pretty_name, favorite_group_path(favgroup) %>
|
||||
<% if favgroup.post_count > CurrentUser.user.per_page %>
|
||||
<%= link_to "page #{favgroup.last_page}", favorite_group_path(favgroup, :page => favgroup.last_page), :class => "last-page" %>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<%= f.submit "Search" %>
|
||||
<% end %>
|
||||
|
||||
<%= table_for @forum_post_votes, {class: "striped autofit"} do |t| %>
|
||||
<%= table_for @forum_post_votes, class: "striped autofit" do |t| %>
|
||||
<% t.column "Forum Post" do |forum_post_vote| %>
|
||||
<%= link_to "Forum ##{forum_post_vote.forum_post_id}", forum_post_vote.forum_post %>
|
||||
<%= link_to "»", forum_post_votes_path(search: { forum_post_id: forum_post_vote.forum_post_id }) %>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<%= table_for @ip_addresses, {class: "striped autofit"} do |t| %>
|
||||
<%= table_for @ip_addresses, class: "striped autofit" do |t| %>
|
||||
<% t.column "IP Address" do |ip| %>
|
||||
<%= link_to ip.ip_addr, ip_addresses_path(search: { ip_addr: ip.ip_addr }) %>
|
||||
<%= link_to "»", ip_addresses_path(search: { ip_addr: ip.ip_addr, group_by: "user" }) %>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<%= link_to "Find all users associated with the top 10 IP addresses", ip_addresses_path(search: { ip_addr: @ip_addresses.map(&:to_s).take(10).join(" "), group_by: "user" }) %>
|
||||
</p>
|
||||
|
||||
<%= table_for @ip_addresses, {class: "striped autofit"} do |t| %>
|
||||
<%= table_for @ip_addresses, class: "striped autofit" do |t| %>
|
||||
<% t.column "IP Address" do |ip| %>
|
||||
<%= link_to ip.to_s, ip_addresses_path(search: { ip_addr: ip.to_s }) %>
|
||||
<%= link_to "»", ip_addresses_path(search: { ip_addr: ip.to_s, group_by: "user" }) %>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<%= link_to "Find all IP addresses associated with these users", ip_addresses_path(search: { user_id: @ip_addresses.map(&:user_id).join(" "), group_by: "ip_addr" }) %>
|
||||
</p>
|
||||
|
||||
<%= table_for @ip_addresses, {class: "striped autofit"} do |t| %>
|
||||
<%= table_for @ip_addresses, class: "striped autofit" do |t| %>
|
||||
<% t.column "User" do |ip| %>
|
||||
<%= link_to_user ip.user %>
|
||||
<%= link_to "»", ip_addresses_path(search: { user_id: ip.user_id, group_by: "ip_addr" }) %>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
<%= render "search" %>
|
||||
|
||||
<%= table_for @mod_actions, {class: "striped autofit"} do |t| %>
|
||||
<%= table_for @mod_actions, class: "striped autofit" do |t| %>
|
||||
<% t.column "Category" do |mod_action| %>
|
||||
<%= link_to mod_action.category.humanize, mod_actions_path(search: { category: mod_action.category_id }) %>
|
||||
<% end %>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<div id="p-<%= listing_type(:post_id, :note_id) %>-listing">
|
||||
|
||||
<%= table_for @note_versions, {class: "striped autofit", width: "100%"} do |t| %>
|
||||
<%= table_for @note_versions, class: "striped autofit", width: "100%" do |t| %>
|
||||
<% t.column "Post", width: "5%" do |note_version| %>
|
||||
<%= link_to note_version.post_id, post_path(note_version.post_id) %>
|
||||
<% if !params.dig(:search, :post_id).present? %>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<div id="a-index">
|
||||
<h1>Notes</h1>
|
||||
|
||||
<%= table_for @notes, {class: "striped autofit"} do |t| %>
|
||||
<%= table_for @notes, class: "striped autofit" do |t| %>
|
||||
<% t.column "Post" do |note| %>
|
||||
<%= link_to note.post_id, note.post %>
|
||||
<% end %>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<div id="p-<%= listing_type(:pool_id) %>-listing">
|
||||
|
||||
<%= table_for @pool_versions, {class: "striped autofit", width: "100%"} do |t| %>
|
||||
<%= table_for @pool_versions, class: "striped autofit", width: "100%" do |t| %>
|
||||
<% t.column column: "diff", width: "3%" do |pool_version| %>
|
||||
<%= link_to_if pool_version_show_diff(pool_version, params[:type]), "diff", diff_pool_version_path(pool_version.id) %>
|
||||
<% end %>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<%= f.submit "Search" %>
|
||||
<% end %>
|
||||
|
||||
<%= table_for @post_disapprovals, {class: "striped autofit", width: "100%"} do |t| %>
|
||||
<%= table_for @post_disapprovals, class: "striped autofit", width: "100%" do |t| %>
|
||||
<% t.column "Post" do |post_disapproval| %>
|
||||
<%= link_to "post ##{post_disapproval.post_id}", post_path(post_disapproval.post_id) %>
|
||||
<%= link_to "»", post_disapprovals_path(search: params[:search].merge(post_id: post_disapproval.post_id)) %>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<%= f.submit "Search" %>
|
||||
<% end %>
|
||||
|
||||
<%= table_for @post_replacements, {class: "striped autofit", width: "100%"} do |t| %>
|
||||
<%= table_for @post_replacements, class: "striped autofit", width: "100%" do |t| %>
|
||||
<% t.column "Post", width: "1%" do |post_replacement| %>
|
||||
<%= PostPresenter.preview(post_replacement.post, show_deleted: true) %>
|
||||
<% end %>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<%= f.submit "Search" %>
|
||||
<% end %>
|
||||
|
||||
<%= table_for @post_votes, {class: "striped autofit"} do |t| %>
|
||||
<%= table_for @post_votes, class: "striped autofit" do |t| %>
|
||||
<% t.column "Post" do |vote| %>
|
||||
<%= PostPresenter.preview(vote.post, show_deleted: true) %>
|
||||
<% end %>
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<%= f.submit "Search" %>
|
||||
<% end %>
|
||||
|
||||
<%= table_for @saved_searches, {class: "striped autofit", width: "100%"} do |t| %>
|
||||
<%= table_for @saved_searches, class: "striped autofit", width: "100%" do |t| %>
|
||||
<% t.column "Query", th: {"data-sort": "string"}, td: {class: "col-expand"} do |ss| %>
|
||||
<%= link_to ss.query, posts_path(tags: ss.query) %>
|
||||
<% end %>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<%= tag.table table.table_attributes do %>
|
||||
<%= tag.table **table.table_attributes do %>
|
||||
<thead>
|
||||
<tr>
|
||||
<% table.columns.each do |column| %>
|
||||
<%= tag.th column.header_attributes do %>
|
||||
<%= tag.th **column.header_attributes do %>
|
||||
<%= column.name %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
@@ -11,9 +11,9 @@
|
||||
|
||||
<tbody>
|
||||
<% table.items.each_with_index do |item, i| %>
|
||||
<%= tag.tr table.all_row_attributes(item, i) do %>
|
||||
<%= tag.tr **table.all_row_attributes(item, i) do %>
|
||||
<% table.columns.each_with_index do |column, j| %>
|
||||
<%= tag.td column.body_attributes do %>
|
||||
<%= tag.td **column.body_attributes do %>
|
||||
<%= column.value(item, i, j) %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<div id="a-index" class="fixed-width-container">
|
||||
<%= render "search" %>
|
||||
|
||||
<%= table_for @tags, {class: "striped autofit"} do |t| %>
|
||||
<%= table_for @tags, class: "striped autofit" do |t| %>
|
||||
<% t.column :post_count, name: "Count" %>
|
||||
<% t.column "Name", td: {class: "col-expand"} do |tag| %>
|
||||
<%= link_to_wiki "?", tag.name, class: tag_class(tag) %>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<%= render "uploads/search" %>
|
||||
<%= render "posts/partials/common/inline_blacklist" %>
|
||||
|
||||
<%= table_for @uploads, {class: "striped autofit", width: "100%"} do |t| %>
|
||||
<%= table_for @uploads, class: "striped autofit", width: "100%" do |t| %>
|
||||
<% t.column "Upload" do |upload| %>
|
||||
<%= PostPresenter.preview(upload.post, tags: "user:#{upload.uploader.name}", show_deleted: true) %>
|
||||
<% end %>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<%= f.submit "Search" %>
|
||||
<% end %>
|
||||
|
||||
<%= table_for @user_feedbacks, {class: "striped autofit"} do |t| %>
|
||||
<%= table_for @user_feedbacks, class: "striped autofit" do |t| %>
|
||||
<% t.column "User" do |feedback| %>
|
||||
<%= link_to_user feedback.user %>
|
||||
<%= link_to "»", user_feedbacks_path(search: { user_name: feedback.user.name }) %>
|
||||
|
||||
@@ -127,7 +127,7 @@ class UsersControllerTest < ActionDispatch::IntegrationTest
|
||||
assert_redirected_to User.last
|
||||
assert_equal("xxx", User.last.name)
|
||||
assert_equal(User.last, User.last.authenticate_password("xxxxx1"))
|
||||
assert_equal(nil, User.last.email_address)
|
||||
assert_nil(User.last.email_address)
|
||||
assert_no_enqueued_emails
|
||||
end
|
||||
|
||||
|
||||
@@ -89,25 +89,25 @@ class ActionDispatch::IntegrationTest
|
||||
mock_post_version_service!
|
||||
mock_pool_version_service!
|
||||
|
||||
def method_authenticated(method_name, url, user, options)
|
||||
def method_authenticated(method_name, url, user, **options)
|
||||
post session_path, params: { name: user.name, password: user.password }
|
||||
self.send(method_name, url, options)
|
||||
send(method_name, url, **options)
|
||||
end
|
||||
|
||||
def get_auth(url, user, options = {})
|
||||
method_authenticated(:get, url, user, options)
|
||||
def get_auth(url, user, **options)
|
||||
method_authenticated(:get, url, user, **options)
|
||||
end
|
||||
|
||||
def post_auth(url, user, options = {})
|
||||
method_authenticated(:post, url, user, options)
|
||||
def post_auth(url, user, **options)
|
||||
method_authenticated(:post, url, user, **options)
|
||||
end
|
||||
|
||||
def put_auth(url, user, options = {})
|
||||
method_authenticated(:put, url, user, options)
|
||||
def put_auth(url, user, **options)
|
||||
method_authenticated(:put, url, user, **options)
|
||||
end
|
||||
|
||||
def delete_auth(url, user, options = {})
|
||||
method_authenticated(:delete, url, user, options)
|
||||
def delete_auth(url, user, **options)
|
||||
method_authenticated(:delete, url, user, **options)
|
||||
end
|
||||
|
||||
def setup
|
||||
|
||||
@@ -21,7 +21,7 @@ class PostDisapprovalTest < ActiveSupport::TestCase
|
||||
|
||||
should "not allow blank messages" do
|
||||
@post_disapproval = create(:post_disapproval, post: @post_1, message: "")
|
||||
assert_equal(nil, @post_disapproval.message)
|
||||
assert_nil(@post_disapproval.message)
|
||||
end
|
||||
|
||||
context "made by alice" do
|
||||
|
||||
Reference in New Issue
Block a user