Skip to content

Commit cbf0046

Browse files
authored
Merge pull request rails#51608 from Shopify/block-warning-fixes
Fix some more ignored block warnings
2 parents cc638d1 + d5c88d6 commit cbf0046

File tree

4 files changed

+25
-7
lines changed

4 files changed

+25
-7
lines changed

actionpack/test/controller/filters_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ def action_two
514514
@filters << "action_two"
515515
end
516516

517-
def non_yielding_action
517+
def non_yielding_action(&_)
518518
@filters << "it didn't yield"
519519
end
520520

actionpack/test/controller/resources_test.rb

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1218,7 +1218,11 @@ def assert_restful_routes_for(controller_name, options = {})
12181218
assert_recognizes(options[:shallow_options].merge(action: "update", id: "1", format: "xml"), path: "#{member_path}.xml", method: :put)
12191219
assert_recognizes(options[:shallow_options].merge(action: "destroy", id: "1", format: "xml"), path: "#{member_path}.xml", method: :delete)
12201220

1221-
yield route_options if block_given?
1221+
if block_given?
1222+
_assert_nothing_raised_or_warn("assert_restful_routes_for") do
1223+
yield route_options
1224+
end
1225+
end
12221226
end
12231227

12241228
# test named routes like foo_path and foos_path map to the correct options.
@@ -1267,7 +1271,11 @@ def assert_restful_named_routes_for(controller_name, singular_name = nil, option
12671271
assert_named_route "#{shallow_path}/1/#{edit_action}", "edit_#{shallow_prefix}#{singular_name}_path", options[:shallow_options].merge(id: "1")
12681272
assert_named_route "#{shallow_path}/1/#{edit_action}.xml", "edit_#{shallow_prefix}#{singular_name}_path", options[:shallow_options].merge(id: "1", format: "xml")
12691273

1270-
yield route_options if block_given?
1274+
if block_given?
1275+
_assert_nothing_raised_or_warn("assert_restful_named_routes_for") do
1276+
yield route_options
1277+
end
1278+
end
12711279
end
12721280

12731281
def assert_singleton_routes_for(singleton_name, options = {})
@@ -1302,7 +1310,11 @@ def assert_singleton_routes_for(singleton_name, options = {})
13021310
assert_recognizes(route_options.merge(action: "update", format: "xml"), path: "#{full_path}.xml", method: :put)
13031311
assert_recognizes(route_options.merge(action: "destroy", format: "xml"), path: "#{full_path}.xml", method: :delete)
13041312

1305-
yield route_options if block_given?
1313+
if block_given?
1314+
_assert_nothing_raised_or_warn("assert_singleton_routes_for") do
1315+
yield route_options
1316+
end
1317+
end
13061318
end
13071319

13081320
def assert_singleton_named_routes_for(singleton_name, options = {})
@@ -1323,6 +1335,12 @@ def assert_singleton_named_routes_for(singleton_name, options = {})
13231335
assert_named_route "#{full_path}/new.xml", "new_#{name_prefix}#{singleton_name}_path", route_options.merge(format: "xml")
13241336
assert_named_route "#{full_path}/edit", "edit_#{name_prefix}#{singleton_name}_path", route_options
13251337
assert_named_route "#{full_path}/edit.xml", "edit_#{name_prefix}#{singleton_name}_path", route_options.merge(format: "xml")
1338+
1339+
if block_given?
1340+
_assert_nothing_raised_or_warn("assert_singleton_named_routes_for") do
1341+
yield route_options
1342+
end
1343+
end
13261344
end
13271345

13281346
def assert_named_route(expected, route, options)

activejob/lib/active_job/enqueuing.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def perform_later(...)
7575
end
7676

7777
private
78-
def job_or_instantiate(*args) # :doc:
78+
def job_or_instantiate(*args, &_) # :doc:
7979
args.first.is_a?(self) ? args.first : new(*args)
8080
end
8181
ruby2_keywords(:job_or_instantiate)

activerecord/test/cases/serialized_attribute_test.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -502,12 +502,12 @@ def test_decorated_type_with_decorator_block
502502
klass = Class.new(ActiveRecord::Base) do
503503
self.table_name = Topic.table_name
504504
store :content, coder: ActiveRecord::Coders::JSON
505-
attribute(:content) { |subtype| EncryptedType.new(subtype: subtype) }
505+
attribute(:content, EncryptedType.new(subtype: Topic.attribute_types.fetch("content")))
506506
end
507507

508508
topic = klass.create!(content: { trial: true })
509509

510-
assert_equal({ "trial" => true }, topic.content)
510+
assert_equal({ trial: true }, topic.content)
511511
end
512512

513513
def test_mutation_detection_does_not_double_serialize

0 commit comments

Comments
 (0)