From f679933daa257a23095a6d7ad04aa2cbd3c7907e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?= Date: Tue, 25 Sep 2018 13:18:20 -0400 Subject: Change the empty block style to have space inside of the block --- .rubocop.yml | 1 + actionmailer/test/assert_select_email_test.rb | 2 +- actionpack/test/controller/base_test.rb | 2 +- actionpack/test/controller/live_stream_test.rb | 2 +- actionpack/test/controller/metal_test.rb | 2 +- actionpack/test/controller/mime/respond_to_test.rb | 2 +- actionpack/test/controller/routing_test.rb | 2 +- actionpack/test/dispatch/middleware_stack_test.rb | 2 +- actionpack/test/dispatch/request_test.rb | 2 +- actionpack/test/dispatch/routing/inspector_test.rb | 4 +- .../test/fixtures/alternate_helpers/foo_helper.rb | 2 +- actionview/test/activerecord/debug_helper_test.rb | 2 +- actionview/test/template/capture_helper_test.rb | 2 +- .../test/template/form_helper/form_with_test.rb | 16 +++---- actionview/test/template/form_helper_test.rb | 14 +++--- .../test/template/form_options_helper_test.rb | 2 +- actionview/test/template/test_case_test.rb | 2 +- activejob/test/cases/test_helper_test.rb | 2 +- activemodel/test/cases/callbacks_test.rb | 2 +- activerecord/examples/performance.rb | 2 +- .../postgresql/referential_integrity_test.rb | 2 +- .../cases/adapters/sqlite3/sqlite3_adapter_test.rb | 2 +- .../test/cases/associations/extension_test.rb | 2 +- activerecord/test/cases/associations_test.rb | 2 +- activerecord/test/cases/batches_test.rb | 28 +++++------ activerecord/test/cases/callbacks_test.rb | 6 +-- .../test/cases/connection_management_test.rb | 2 +- activerecord/test/cases/connection_pool_test.rb | 2 +- activerecord/test/cases/finder_respond_to_test.rb | 2 +- activerecord/test/cases/fixtures_test.rb | 2 +- .../test/cases/migration/command_recorder_test.rb | 6 +-- .../cases/migration/pending_migrations_test.rb | 4 +- activerecord/test/cases/migration_test.rb | 2 +- .../test/cases/scoping/named_scoping_test.rb | 2 +- activerecord/test/cases/suppressor_test.rb | 2 +- .../test/cases/transaction_isolation_test.rb | 4 +- activerecord/test/cases/transactions_test.rb | 10 ++-- activerecord/test/models/author.rb | 2 +- activerecord/test/models/topic.rb | 2 +- activerecord/test/schema/schema.rb | 2 +- activestorage/test/service/shared_service_tests.rb | 2 +- activesupport/lib/active_support/cache.rb | 2 +- .../active_support/core_ext/class/subclasses.rb | 2 +- .../lib/active_support/deprecation/behaviors.rb | 2 +- activesupport/test/benchmarkable_test.rb | 4 +- .../test/cache/behaviors/cache_store_behavior.rb | 4 +- .../test/cache/local_cache_middleware_test.rb | 2 +- activesupport/test/callbacks_test.rb | 4 +- activesupport/test/core_ext/array/extract_test.rb | 2 +- .../test/core_ext/module/concerning_test.rb | 2 +- activesupport/test/core_ext/range_ext_test.rb | 8 ++-- activesupport/test/core_ext/time_with_zone_test.rb | 2 +- activesupport/test/dependencies_test.rb | 4 +- .../test/evented_file_update_checker_test.rb | 2 +- activesupport/test/executor_test.rb | 18 ++++---- activesupport/test/notifications_test.rb | 2 +- activesupport/test/reloader_test.rb | 8 ++-- activesupport/test/share_lock_test.rb | 54 +++++++++++----------- railties/lib/rails/test_unit/runner.rb | 4 +- railties/test/rack_logger_test.rb | 2 +- 60 files changed, 142 insertions(+), 141 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index c6c8d8ca00..2ac31637ef 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -137,6 +137,7 @@ Layout/SpaceBeforeBlockBraces: # Use `foo { bar }` not `foo {bar}`. Layout/SpaceInsideBlockBraces: Enabled: true + EnforcedStyleForEmptyBraces: space # Use `{ a: 1 }` not `{a:1}`. Layout/SpaceInsideHashLiteralBraces: diff --git a/actionmailer/test/assert_select_email_test.rb b/actionmailer/test/assert_select_email_test.rb index eb58ddd9c9..9699fe4000 100644 --- a/actionmailer/test/assert_select_email_test.rb +++ b/actionmailer/test/assert_select_email_test.rb @@ -25,7 +25,7 @@ class AssertSelectEmailTest < ActionMailer::TestCase def test_assert_select_email assert_raise ActiveSupport::TestCase::Assertion do - assert_select_email {} + assert_select_email { } end AssertSelectMailer.test("

foo

bar

").deliver_now diff --git a/actionpack/test/controller/base_test.rb b/actionpack/test/controller/base_test.rb index a672ede1a9..d8cea10153 100644 --- a/actionpack/test/controller/base_test.rb +++ b/actionpack/test/controller/base_test.rb @@ -138,7 +138,7 @@ class ControllerInstanceTests < ActiveSupport::TestCase response_headers = SimpleController.action("hello").call( "REQUEST_METHOD" => "GET", - "rack.input" => -> {} + "rack.input" => -> { } )[1] assert response_headers.key?("X-Frame-Options") diff --git a/actionpack/test/controller/live_stream_test.rb b/actionpack/test/controller/live_stream_test.rb index 431fe90b23..d81c43b87d 100644 --- a/actionpack/test/controller/live_stream_test.rb +++ b/actionpack/test/controller/live_stream_test.rb @@ -304,7 +304,7 @@ module ActionController # Simulate InterlockHook ActiveSupport::Dependencies.interlock.start_running res = get :write_sleep_autoload - res.each {} + res.each { } ActiveSupport::Dependencies.interlock.done_running end diff --git a/actionpack/test/controller/metal_test.rb b/actionpack/test/controller/metal_test.rb index 248ef36b7c..7b53092266 100644 --- a/actionpack/test/controller/metal_test.rb +++ b/actionpack/test/controller/metal_test.rb @@ -20,7 +20,7 @@ class MetalControllerInstanceTests < ActiveSupport::TestCase response_headers = SimpleController.action("hello").call( "REQUEST_METHOD" => "GET", - "rack.input" => -> {} + "rack.input" => -> { } )[1] assert_not response_headers.key?("X-Frame-Options") diff --git a/actionpack/test/controller/mime/respond_to_test.rb b/actionpack/test/controller/mime/respond_to_test.rb index 1163775d3c..00e1d5f3b3 100644 --- a/actionpack/test/controller/mime/respond_to_test.rb +++ b/actionpack/test/controller/mime/respond_to_test.rb @@ -78,7 +78,7 @@ class RespondToController < ActionController::Base def missing_templates respond_to do |type| # This test requires a block that is empty - type.json {} + type.json { } type.xml end end diff --git a/actionpack/test/controller/routing_test.rb b/actionpack/test/controller/routing_test.rb index a2a811f090..b97454f1a4 100644 --- a/actionpack/test/controller/routing_test.rb +++ b/actionpack/test/controller/routing_test.rb @@ -309,7 +309,7 @@ class LegacyRouteSetTests < ActiveSupport::TestCase def test_specific_controller_action_failure rs.draw do - mount lambda {} => "/foo" + mount lambda { } => "/foo" end assert_raises(ActionController::UrlGenerationError) do diff --git a/actionpack/test/dispatch/middleware_stack_test.rb b/actionpack/test/dispatch/middleware_stack_test.rb index e9f7ad41dd..5f43e5a3c5 100644 --- a/actionpack/test/dispatch/middleware_stack_test.rb +++ b/actionpack/test/dispatch/middleware_stack_test.rb @@ -42,7 +42,7 @@ class MiddlewareStackTest < ActiveSupport::TestCase end test "use should push middleware class with block arguments onto the stack" do - proc = Proc.new {} + proc = Proc.new { } assert_difference "@stack.size" do @stack.use(BlockMiddleware, &proc) end diff --git a/actionpack/test/dispatch/request_test.rb b/actionpack/test/dispatch/request_test.rb index 0ac8713527..c7b68e5266 100644 --- a/actionpack/test/dispatch/request_test.rb +++ b/actionpack/test/dispatch/request_test.rb @@ -24,7 +24,7 @@ class BaseRequestTest < ActiveSupport::TestCase def stub_request(env = {}) ip_spoofing_check = env.key?(:ip_spoofing_check) ? env.delete(:ip_spoofing_check) : true @trusted_proxies ||= nil - ip_app = ActionDispatch::RemoteIp.new(Proc.new {}, ip_spoofing_check, @trusted_proxies) + ip_app = ActionDispatch::RemoteIp.new(Proc.new { }, ip_spoofing_check, @trusted_proxies) ActionDispatch::Http::URL.tld_length = env.delete(:tld_length) if env.key?(:tld_length) ip_app.call(env) diff --git a/actionpack/test/dispatch/routing/inspector_test.rb b/actionpack/test/dispatch/routing/inspector_test.rb index f1f6547889..fe1f1995d8 100644 --- a/actionpack/test/dispatch/routing/inspector_test.rb +++ b/actionpack/test/dispatch/routing/inspector_test.rb @@ -373,7 +373,7 @@ module ActionDispatch end def test_not_routes_when_expanded - output = draw(grep: "rails/dummy", formatter: ActionDispatch::Routing::ConsoleFormatter::Expanded.new) {} + output = draw(grep: "rails/dummy", formatter: ActionDispatch::Routing::ConsoleFormatter::Expanded.new) { } assert_equal [ "You don't have any routes defined!", @@ -450,7 +450,7 @@ module ActionDispatch end def test_no_routes_were_defined - output = draw(grep: "Rails::DummyController") {} + output = draw(grep: "Rails::DummyController") { } assert_equal [ "You don't have any routes defined!", diff --git a/actionpack/test/fixtures/alternate_helpers/foo_helper.rb b/actionpack/test/fixtures/alternate_helpers/foo_helper.rb index 3aadb6145e..c1a995af5f 100644 --- a/actionpack/test/fixtures/alternate_helpers/foo_helper.rb +++ b/actionpack/test/fixtures/alternate_helpers/foo_helper.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module FooHelper - redefine_method(:baz) {} + redefine_method(:baz) { } end diff --git a/actionview/test/activerecord/debug_helper_test.rb b/actionview/test/activerecord/debug_helper_test.rb index 4be1023733..87a1791573 100644 --- a/actionview/test/activerecord/debug_helper_test.rb +++ b/actionview/test/activerecord/debug_helper_test.rb @@ -13,7 +13,7 @@ class DebugHelperTest < ActionView::TestCase end def test_debug_with_marshal_error - obj = -> {} + obj = -> { } assert_match obj.inspect, Nokogiri.XML(debug(obj)).content end end diff --git a/actionview/test/template/capture_helper_test.rb b/actionview/test/template/capture_helper_test.rb index 131e49327e..3d96c81be9 100644 --- a/actionview/test/template/capture_helper_test.rb +++ b/actionview/test/template/capture_helper_test.rb @@ -219,7 +219,7 @@ class CaptureHelperTest < ActionView::TestCase def test_with_output_buffer_does_not_assume_there_is_an_output_buffer assert_nil @av.output_buffer - assert_equal "", @av.with_output_buffer {} + assert_equal "", @av.with_output_buffer { } end def alt_encoding(output_buffer) diff --git a/actionview/test/template/form_helper/form_with_test.rb b/actionview/test/template/form_helper/form_with_test.rb index f38833f256..f84c9b2b73 100644 --- a/actionview/test/template/form_helper/form_with_test.rb +++ b/actionview/test/template/form_helper/form_with_test.rb @@ -2246,7 +2246,7 @@ class FormWithActsLikeFormForTest < FormWithTest post.persisted = false def post.to_key; nil; end - form_with(model: post) {} + form_with(model: post) { } expected = whole_form("/posts") assert_dom_equal expected, output_buffer @@ -2254,14 +2254,14 @@ class FormWithActsLikeFormForTest < FormWithTest def test_form_with_with_existing_object_in_list @comment.save - form_with(model: [@post, @comment]) {} + form_with(model: [@post, @comment]) { } expected = whole_form(post_comment_path(@post, @comment), method: "patch") assert_dom_equal expected, output_buffer end def test_form_with_with_new_object_in_list - form_with(model: [@post, @comment]) {} + form_with(model: [@post, @comment]) { } expected = whole_form(post_comments_path(@post)) assert_dom_equal expected, output_buffer @@ -2269,14 +2269,14 @@ class FormWithActsLikeFormForTest < FormWithTest def test_form_with_with_existing_object_and_namespace_in_list @comment.save - form_with(model: [:admin, @post, @comment]) {} + form_with(model: [:admin, @post, @comment]) { } expected = whole_form(admin_post_comment_path(@post, @comment), method: "patch") assert_dom_equal expected, output_buffer end def test_form_with_with_new_object_and_namespace_in_list - form_with(model: [:admin, @post, @comment]) {} + form_with(model: [:admin, @post, @comment]) { } expected = whole_form(admin_post_comments_path(@post)) assert_dom_equal expected, output_buffer @@ -2290,13 +2290,13 @@ class FormWithActsLikeFormForTest < FormWithTest end def test_form_with_with_default_method_as_patch - form_with(model: @post) {} + form_with(model: @post) { } expected = whole_form("/posts/123", method: "patch") assert_dom_equal expected, output_buffer end def test_form_with_with_data_attributes - form_with(model: @post, data: { behavior: "stuff" }) {} + form_with(model: @post, data: { behavior: "stuff" }) { } assert_match %r|data-behavior="stuff"|, output_buffer assert_match %r|data-remote="true"|, output_buffer end @@ -2315,7 +2315,7 @@ class FormWithActsLikeFormForTest < FormWithTest end end - form_with(model: @post, builder: builder_class) {} + form_with(model: @post, builder: builder_class) { } assert_equal 1, initialization_count, "form builder instantiated more than once" end diff --git a/actionview/test/template/form_helper_test.rb b/actionview/test/template/form_helper_test.rb index 601fa6e8eb..5972946074 100644 --- a/actionview/test/template/form_helper_test.rb +++ b/actionview/test/template/form_helper_test.rb @@ -3488,14 +3488,14 @@ class FormHelperTest < ActionView::TestCase def test_form_for_with_existing_object_in_list @comment.save - form_for([@post, @comment]) {} + form_for([@post, @comment]) { } expected = whole_form(post_comment_path(@post, @comment), "edit_comment_1", "edit_comment", method: "patch") assert_dom_equal expected, output_buffer end def test_form_for_with_new_object_in_list - form_for([@post, @comment]) {} + form_for([@post, @comment]) { } expected = whole_form(post_comments_path(@post), "new_comment", "new_comment") assert_dom_equal expected, output_buffer @@ -3503,14 +3503,14 @@ class FormHelperTest < ActionView::TestCase def test_form_for_with_existing_object_and_namespace_in_list @comment.save - form_for([:admin, @post, @comment]) {} + form_for([:admin, @post, @comment]) { } expected = whole_form(admin_post_comment_path(@post, @comment), "edit_comment_1", "edit_comment", method: "patch") assert_dom_equal expected, output_buffer end def test_form_for_with_new_object_and_namespace_in_list - form_for([:admin, @post, @comment]) {} + form_for([:admin, @post, @comment]) { } expected = whole_form(admin_post_comments_path(@post), "new_comment", "new_comment") assert_dom_equal expected, output_buffer @@ -3524,13 +3524,13 @@ class FormHelperTest < ActionView::TestCase end def test_form_for_with_default_method_as_patch - form_for(@post) {} + form_for(@post) { } expected = whole_form("/posts/123", "edit_post_123", "edit_post", method: "patch") assert_dom_equal expected, output_buffer end def test_form_for_with_data_attributes - form_for(@post, data: { behavior: "stuff" }, remote: true) {} + form_for(@post, data: { behavior: "stuff" }, remote: true) { } assert_match %r|data-behavior="stuff"|, output_buffer assert_match %r|data-remote="true"|, output_buffer end @@ -3549,7 +3549,7 @@ class FormHelperTest < ActionView::TestCase end end - form_for(@post, builder: builder_class) {} + form_for(@post, builder: builder_class) { } assert_equal 1, initialization_count, "form builder instantiated more than once" end diff --git a/actionview/test/template/form_options_helper_test.rb b/actionview/test/template/form_options_helper_test.rb index 8a0a706fef..a2d1474a94 100644 --- a/actionview/test/template/form_options_helper_test.rb +++ b/actionview/test/template/form_options_helper_test.rb @@ -668,7 +668,7 @@ class FormOptionsHelperTest < ActionView::TestCase @post = Post.new output_buffer = fields_for :post, @post do |f| - concat(f.select(:category) {}) + concat(f.select(:category) { }) end assert_dom_equal( diff --git a/actionview/test/template/test_case_test.rb b/actionview/test/template/test_case_test.rb index 27f5a7cc3e..976b6bc77e 100644 --- a/actionview/test/template/test_case_test.rb +++ b/actionview/test/template/test_case_test.rb @@ -242,7 +242,7 @@ module ActionView @routes ||= ActionDispatch::Routing::RouteSet.new end - routes.draw { get "bar", to: lambda {} } + routes.draw { get "bar", to: lambda { } } def self.call(*) end diff --git a/activejob/test/cases/test_helper_test.rb b/activejob/test/cases/test_helper_test.rb index 1e3fcf1fc2..018c40c28f 100644 --- a/activejob/test/cases/test_helper_test.rb +++ b/activejob/test/cases/test_helper_test.rb @@ -504,7 +504,7 @@ class EnqueuedJobsTest < ActiveJob::TestCase assert_raise ActiveSupport::TestCase::Assertion do LoggingJob.perform_later - assert_enqueued_with(job: LoggingJob) {} + assert_enqueued_with(job: LoggingJob) { } end error = assert_raise ActiveSupport::TestCase::Assertion do diff --git a/activemodel/test/cases/callbacks_test.rb b/activemodel/test/cases/callbacks_test.rb index 1ec12d8222..0711dc56ca 100644 --- a/activemodel/test/cases/callbacks_test.rb +++ b/activemodel/test/cases/callbacks_test.rb @@ -112,7 +112,7 @@ class CallbacksTest < ActiveModel::TestCase def callback1; history << "callback1"; end def callback2; history << "callback2"; end def create - run_callbacks(:create) {} + run_callbacks(:create) { } self end end diff --git a/activerecord/examples/performance.rb b/activerecord/examples/performance.rb index 1a2c78f39b..024e503ec7 100644 --- a/activerecord/examples/performance.rb +++ b/activerecord/examples/performance.rb @@ -176,7 +176,7 @@ Benchmark.ips(TIME) do |x| end x.report "Model.log" do - Exhibit.connection.send(:log, "hello", "world") {} + Exhibit.connection.send(:log, "hello", "world") { } end x.report "AR.execute(query)" do diff --git a/activerecord/test/cases/adapters/postgresql/referential_integrity_test.rb b/activerecord/test/cases/adapters/postgresql/referential_integrity_test.rb index 0bcc214c24..ba477c63f4 100644 --- a/activerecord/test/cases/adapters/postgresql/referential_integrity_test.rb +++ b/activerecord/test/cases/adapters/postgresql/referential_integrity_test.rb @@ -101,7 +101,7 @@ class PostgreSQLReferentialIntegrityTest < ActiveRecord::PostgreSQLTestCase @connection.extend ProgrammerMistake assert_raises ArgumentError do - @connection.disable_referential_integrity {} + @connection.disable_referential_integrity { } end end diff --git a/activerecord/test/cases/adapters/sqlite3/sqlite3_adapter_test.rb b/activerecord/test/cases/adapters/sqlite3/sqlite3_adapter_test.rb index 70d0a71c53..89052019f8 100644 --- a/activerecord/test/cases/adapters/sqlite3/sqlite3_adapter_test.rb +++ b/activerecord/test/cases/adapters/sqlite3/sqlite3_adapter_test.rb @@ -87,7 +87,7 @@ module ActiveRecord def test_connection_no_db assert_raises(ArgumentError) do - Base.sqlite3_connection {} + Base.sqlite3_connection { } end end diff --git a/activerecord/test/cases/associations/extension_test.rb b/activerecord/test/cases/associations/extension_test.rb index 5eacb5a3d8..aef8f31112 100644 --- a/activerecord/test/cases/associations/extension_test.rb +++ b/activerecord/test/cases/associations/extension_test.rb @@ -89,6 +89,6 @@ class AssociationsExtensionsTest < ActiveRecord::TestCase private def extend!(model) - ActiveRecord::Associations::Builder::HasMany.define_extensions(model, :association_name) {} + ActiveRecord::Associations::Builder::HasMany.define_extensions(model, :association_name) { } end end diff --git a/activerecord/test/cases/associations_test.rb b/activerecord/test/cases/associations_test.rb index 739eb02e0c..081da95df7 100644 --- a/activerecord/test/cases/associations_test.rb +++ b/activerecord/test/cases/associations_test.rb @@ -80,7 +80,7 @@ class AssociationsTest < ActiveRecord::TestCase def test_force_reload firm = Firm.new("name" => "A New Firm, Inc") firm.save - firm.clients.each {} # forcing to load all clients + firm.clients.each { } # forcing to load all clients assert firm.clients.empty?, "New firm shouldn't have client objects" assert_equal 0, firm.clients.size, "New firm should have 0 clients" diff --git a/activerecord/test/cases/batches_test.rb b/activerecord/test/cases/batches_test.rb index da4569e38a..d21218a997 100644 --- a/activerecord/test/cases/batches_test.rb +++ b/activerecord/test/cases/batches_test.rb @@ -24,7 +24,7 @@ class EachTest < ActiveRecord::TestCase def test_each_should_not_return_query_chain_and_execute_only_one_query assert_queries(1) do - result = Post.find_each(batch_size: 100000) {} + result = Post.find_each(batch_size: 100000) { } assert_nil result end end @@ -183,7 +183,7 @@ class EachTest < ActiveRecord::TestCase def test_find_in_batches_should_error_on_ignore_the_order assert_raise(ArgumentError) do - PostWithDefaultScope.find_in_batches(error_on_ignore: true) {} + PostWithDefaultScope.find_in_batches(error_on_ignore: true) { } end end @@ -192,7 +192,7 @@ class EachTest < ActiveRecord::TestCase prev = ActiveRecord::Base.error_on_ignored_order ActiveRecord::Base.error_on_ignored_order = true assert_nothing_raised do - PostWithDefaultScope.find_in_batches(error_on_ignore: false) {} + PostWithDefaultScope.find_in_batches(error_on_ignore: false) { } end ensure # Set back to default @@ -204,7 +204,7 @@ class EachTest < ActiveRecord::TestCase prev = ActiveRecord::Base.error_on_ignored_order ActiveRecord::Base.error_on_ignored_order = true assert_raise(ArgumentError) do - PostWithDefaultScope.find_in_batches() {} + PostWithDefaultScope.find_in_batches() { } end ensure # Set back to default @@ -213,7 +213,7 @@ class EachTest < ActiveRecord::TestCase def test_find_in_batches_should_not_error_by_default assert_nothing_raised do - PostWithDefaultScope.find_in_batches() {} + PostWithDefaultScope.find_in_batches() { } end end @@ -228,7 +228,7 @@ class EachTest < ActiveRecord::TestCase def test_find_in_batches_should_not_modify_passed_options assert_nothing_raised do - Post.find_in_batches({ batch_size: 42, start: 1 }.freeze) {} + Post.find_in_batches({ batch_size: 42, start: 1 }.freeze) { } end end @@ -446,7 +446,7 @@ class EachTest < ActiveRecord::TestCase def test_in_batches_should_not_modify_passed_options assert_nothing_raised do - Post.in_batches({ of: 42, start: 1 }.freeze) {} + Post.in_batches({ of: 42, start: 1 }.freeze) { } end end @@ -597,15 +597,15 @@ class EachTest < ActiveRecord::TestCase table: table_alias, predicate_builder: predicate_builder ) - posts.find_each {} + posts.find_each { } end end test ".find_each bypasses the query cache for its own queries" do Post.cache do assert_queries(2) do - Post.find_each {} - Post.find_each {} + Post.find_each { } + Post.find_each { } end end end @@ -624,8 +624,8 @@ class EachTest < ActiveRecord::TestCase test ".find_in_batches bypasses the query cache for its own queries" do Post.cache do assert_queries(2) do - Post.find_in_batches {} - Post.find_in_batches {} + Post.find_in_batches { } + Post.find_in_batches { } end end end @@ -644,8 +644,8 @@ class EachTest < ActiveRecord::TestCase test ".in_batches bypasses the query cache for its own queries" do Post.cache do assert_queries(2) do - Post.in_batches {} - Post.in_batches {} + Post.in_batches { } + Post.in_batches { } end end end diff --git a/activerecord/test/cases/callbacks_test.rb b/activerecord/test/cases/callbacks_test.rb index 253c3099d6..0ea3fb86a6 100644 --- a/activerecord/test/cases/callbacks_test.rb +++ b/activerecord/test/cases/callbacks_test.rb @@ -480,7 +480,7 @@ class CallbacksTest < ActiveRecord::TestCase def test_before_save_doesnt_allow_on_option exception = assert_raises ArgumentError do Class.new(ActiveRecord::Base) do - before_save(on: :create) {} + before_save(on: :create) { } end end assert_equal "Unknown key: :on. Valid keys are: :if, :unless, :prepend", exception.message @@ -489,7 +489,7 @@ class CallbacksTest < ActiveRecord::TestCase def test_around_save_doesnt_allow_on_option exception = assert_raises ArgumentError do Class.new(ActiveRecord::Base) do - around_save(on: :create) {} + around_save(on: :create) { } end end assert_equal "Unknown key: :on. Valid keys are: :if, :unless, :prepend", exception.message @@ -498,7 +498,7 @@ class CallbacksTest < ActiveRecord::TestCase def test_after_save_doesnt_allow_on_option exception = assert_raises ArgumentError do Class.new(ActiveRecord::Base) do - after_save(on: :create) {} + after_save(on: :create) { } end end assert_equal "Unknown key: :on. Valid keys are: :if, :unless, :prepend", exception.message diff --git a/activerecord/test/cases/connection_management_test.rb b/activerecord/test/cases/connection_management_test.rb index 0941ee3309..b9b5cc0e28 100644 --- a/activerecord/test/cases/connection_management_test.rb +++ b/activerecord/test/cases/connection_management_test.rb @@ -106,7 +106,7 @@ module ActiveRecord def middleware(app) lambda do |env| a, b, c = executor.wrap { app.call(env) } - [a, b, Rack::BodyProxy.new(c) {}] + [a, b, Rack::BodyProxy.new(c) { }] end end end diff --git a/activerecord/test/cases/connection_pool_test.rb b/activerecord/test/cases/connection_pool_test.rb index 06869eeab0..633d56e479 100644 --- a/activerecord/test/cases/connection_pool_test.rb +++ b/activerecord/test/cases/connection_pool_test.rb @@ -661,7 +661,7 @@ module ActiveRecord end stuck_thread = Thread.new do - pool.with_connection {} + pool.with_connection { } end # wait for stuck_thread to get in queue diff --git a/activerecord/test/cases/finder_respond_to_test.rb b/activerecord/test/cases/finder_respond_to_test.rb index 59af4e6961..e0acd30c22 100644 --- a/activerecord/test/cases/finder_respond_to_test.rb +++ b/activerecord/test/cases/finder_respond_to_test.rb @@ -12,7 +12,7 @@ class FinderRespondToTest < ActiveRecord::TestCase end def test_should_preserve_normal_respond_to_behaviour_and_respond_to_newly_added_method - class << Topic; self; end.send(:define_method, :method_added_for_finder_respond_to_test) {} + class << Topic; self; end.send(:define_method, :method_added_for_finder_respond_to_test) { } assert_respond_to Topic, :method_added_for_finder_respond_to_test ensure class << Topic; self; end.send(:remove_method, :method_added_for_finder_respond_to_test) diff --git a/activerecord/test/cases/fixtures_test.rb b/activerecord/test/cases/fixtures_test.rb index c65523d8c1..5d5f54ca66 100644 --- a/activerecord/test/cases/fixtures_test.rb +++ b/activerecord/test/cases/fixtures_test.rb @@ -974,7 +974,7 @@ class TransactionalFixturesOnConnectionNotification < ActiveRecord::TestCase connection_id: connection.object_id } - message_bus.instrument("!connection.active_record", payload) {} + message_bus.instrument("!connection.active_record", payload) { } end end end diff --git a/activerecord/test/cases/migration/command_recorder_test.rb b/activerecord/test/cases/migration/command_recorder_test.rb index 1a19b8dafd..199818fc90 100644 --- a/activerecord/test/cases/migration/command_recorder_test.rb +++ b/activerecord/test/cases/migration/command_recorder_test.rb @@ -117,13 +117,13 @@ module ActiveRecord end def test_invert_create_table_with_options_and_block - block = Proc.new {} + block = Proc.new { } drop_table = @recorder.inverse_of :create_table, [:people_reminders, id: false], &block assert_equal [:drop_table, [:people_reminders, id: false], block], drop_table end def test_invert_drop_table - block = Proc.new {} + block = Proc.new { } create_table = @recorder.inverse_of :drop_table, [:people_reminders, id: false], &block assert_equal [:create_table, [:people_reminders, id: false], block], create_table end @@ -145,7 +145,7 @@ module ActiveRecord end def test_invert_drop_join_table - block = Proc.new {} + block = Proc.new { } create_join_table = @recorder.inverse_of :drop_join_table, [:musics, :artists, table_name: :catalog], &block assert_equal [:create_join_table, [:musics, :artists, table_name: :catalog], block], create_join_table end diff --git a/activerecord/test/cases/migration/pending_migrations_test.rb b/activerecord/test/cases/migration/pending_migrations_test.rb index dedb5ea502..119bfd372a 100644 --- a/activerecord/test/cases/migration/pending_migrations_test.rb +++ b/activerecord/test/cases/migration/pending_migrations_test.rb @@ -25,7 +25,7 @@ module ActiveRecord ActiveRecord::Base.connection.drop_table "schema_migrations", if_exists: true assert_raises ActiveRecord::PendingMigrationError do - CheckPending.new(Proc.new {}).call({}) + CheckPending.new(Proc.new { }).call({}) end end @@ -34,7 +34,7 @@ module ActiveRecord migrator = Base.connection.migration_context capture(:stdout) { migrator.migrate } - assert_nil CheckPending.new(Proc.new {}).call({}) + assert_nil CheckPending.new(Proc.new { }).call({}) end end end diff --git a/activerecord/test/cases/migration_test.rb b/activerecord/test/cases/migration_test.rb index 1b38bf5940..5d060c8899 100644 --- a/activerecord/test/cases/migration_test.rb +++ b/activerecord/test/cases/migration_test.rb @@ -1144,7 +1144,7 @@ class CopyMigrationsTest < ActiveRecord::TestCase def test_check_pending_with_stdlib_logger old, ActiveRecord::Base.logger = ActiveRecord::Base.logger, ::Logger.new($stdout) quietly do - assert_nothing_raised { ActiveRecord::Migration::CheckPending.new(Proc.new {}).call({}) } + assert_nothing_raised { ActiveRecord::Migration::CheckPending.new(Proc.new { }).call({}) } end ensure ActiveRecord::Base.logger = old diff --git a/activerecord/test/cases/scoping/named_scoping_test.rb b/activerecord/test/cases/scoping/named_scoping_test.rb index 4214f347fb..f707951a16 100644 --- a/activerecord/test/cases/scoping/named_scoping_test.rb +++ b/activerecord/test/cases/scoping/named_scoping_test.rb @@ -489,7 +489,7 @@ class NamedScopingTest < ActiveRecord::TestCase [:public_method, :protected_method, :private_method].each do |reserved_method| assert Topic.respond_to?(reserved_method, true) assert_called(ActiveRecord::Base.logger, :warn) do - silence_warnings { Topic.scope(reserved_method, -> {}) } + silence_warnings { Topic.scope(reserved_method, -> { }) } end end end diff --git a/activerecord/test/cases/suppressor_test.rb b/activerecord/test/cases/suppressor_test.rb index b68f0033d9..9be5356901 100644 --- a/activerecord/test/cases/suppressor_test.rb +++ b/activerecord/test/cases/suppressor_test.rb @@ -66,7 +66,7 @@ class SuppressorTest < ActiveRecord::TestCase def test_suppresses_when_nested_multiple_times assert_no_difference -> { Notification.count } do Notification.suppress do - Notification.suppress {} + Notification.suppress { } Notification.create Notification.create! Notification.new.save diff --git a/activerecord/test/cases/transaction_isolation_test.rb b/activerecord/test/cases/transaction_isolation_test.rb index 9663955f1f..2932969412 100644 --- a/activerecord/test/cases/transaction_isolation_test.rb +++ b/activerecord/test/cases/transaction_isolation_test.rb @@ -90,7 +90,7 @@ else test "setting isolation when joining a transaction raises an error" do Tag.transaction do assert_raises(ActiveRecord::TransactionIsolationError) do - Tag.transaction(isolation: :serializable) {} + Tag.transaction(isolation: :serializable) { } end end end @@ -98,7 +98,7 @@ else test "setting isolation when starting a nested transaction raises error" do Tag.transaction do assert_raises(ActiveRecord::TransactionIsolationError) do - Tag.transaction(requires_new: true, isolation: :serializable) {} + Tag.transaction(requires_new: true, isolation: :serializable) { } end end end diff --git a/activerecord/test/cases/transactions_test.rb b/activerecord/test/cases/transactions_test.rb index b13cf88c00..50740054f7 100644 --- a/activerecord/test/cases/transactions_test.rb +++ b/activerecord/test/cases/transactions_test.rb @@ -930,7 +930,7 @@ class TransactionTest < ActiveRecord::TestCase klass = Class.new(ActiveRecord::Base) do self.table_name = "transaction_without_primary_keys" - after_commit {} # necessary to trigger the has_transactional_callbacks branch + after_commit { } # necessary to trigger the has_transactional_callbacks branch end assert_no_difference(-> { klass.count }) do @@ -945,7 +945,7 @@ class TransactionTest < ActiveRecord::TestCase def test_empty_transaction_is_not_materialized assert_no_queries do - Topic.transaction {} + Topic.transaction { } end end @@ -968,7 +968,7 @@ class TransactionTest < ActiveRecord::TestCase def test_savepoint_does_not_materialize_transaction assert_no_queries do Topic.transaction do - Topic.transaction(requires_new: true) {} + Topic.transaction(requires_new: true) { } end end end @@ -991,7 +991,7 @@ class TransactionTest < ActiveRecord::TestCase Topic.connection.raw_connection assert_sql(/BEGIN/i, /COMMIT/i) do - Topic.transaction {} + Topic.transaction { } end end @@ -1001,7 +1001,7 @@ class TransactionTest < ActiveRecord::TestCase Topic.connection_pool.checkin connection assert_no_queries do - connection.transaction {} + connection.transaction { } end end diff --git a/activerecord/test/models/author.rb b/activerecord/test/models/author.rb index 75932c7eb6..8b5a2fa0c8 100644 --- a/activerecord/test/models/author.rb +++ b/activerecord/test/models/author.rb @@ -81,7 +81,7 @@ class Author < ActiveRecord::Base after_add: [:log_after_adding, Proc.new { |o, r| o.post_log << "after_adding_proc#{r.id || ''}" }] has_many :unchangeable_posts, class_name: "Post", before_add: :raise_exception, after_add: :log_after_adding - has_many :categorizations, -> {} + has_many :categorizations, -> { } has_many :categories, through: :categorizations has_many :named_categories, through: :categorizations diff --git a/activerecord/test/models/topic.rb b/activerecord/test/models/topic.rb index 72699046f9..4aad6a4498 100644 --- a/activerecord/test/models/topic.rb +++ b/activerecord/test/models/topic.rb @@ -24,7 +24,7 @@ class Topic < ActiveRecord::Base end scope "approved_as_string", -> { where(approved: true) } - scope :anonymous_extension, -> {} do + scope :anonymous_extension, -> { } do def one 1 end diff --git a/activerecord/test/schema/schema.rb b/activerecord/test/schema/schema.rb index 27c7348f5c..2aaf393009 100644 --- a/activerecord/test/schema/schema.rb +++ b/activerecord/test/schema/schema.rb @@ -947,7 +947,7 @@ ActiveRecord::Schema.define do end [:circles, :squares, :triangles, :non_poly_ones, :non_poly_twos].each do |t| - create_table(t, force: true) {} + create_table(t, force: true) { } end create_table :men, force: true do |t| diff --git a/activestorage/test/service/shared_service_tests.rb b/activestorage/test/service/shared_service_tests.rb index 8a8d639af7..ca2490f2bc 100644 --- a/activestorage/test/service/shared_service_tests.rb +++ b/activestorage/test/service/shared_service_tests.rb @@ -77,7 +77,7 @@ module ActiveStorage::Service::SharedServiceTests test "downloading a nonexistent file in chunks" do assert_raises(ActiveStorage::FileNotFoundError) do - @service.download(SecureRandom.base58(24)) {} + @service.download(SecureRandom.base58(24)) { } end end diff --git a/activesupport/lib/active_support/cache.rb b/activesupport/lib/active_support/cache.rb index 8e516de4c9..a5d0c52b13 100644 --- a/activesupport/lib/active_support/cache.rb +++ b/activesupport/lib/active_support/cache.rb @@ -694,7 +694,7 @@ module ActiveSupport end def get_entry_value(entry, name, options) - instrument(:fetch_hit, name, options) {} + instrument(:fetch_hit, name, options) { } entry.value end diff --git a/activesupport/lib/active_support/core_ext/class/subclasses.rb b/activesupport/lib/active_support/core_ext/class/subclasses.rb index 75e65337b7..56fb46a88d 100644 --- a/activesupport/lib/active_support/core_ext/class/subclasses.rb +++ b/activesupport/lib/active_support/core_ext/class/subclasses.rb @@ -3,7 +3,7 @@ class Class begin # Test if this Ruby supports each_object against singleton_class - ObjectSpace.each_object(Numeric.singleton_class) {} + ObjectSpace.each_object(Numeric.singleton_class) { } # Returns an array with all classes that are < than its receiver. # diff --git a/activesupport/lib/active_support/deprecation/behaviors.rb b/activesupport/lib/active_support/deprecation/behaviors.rb index 3abd25aa85..725667d139 100644 --- a/activesupport/lib/active_support/deprecation/behaviors.rb +++ b/activesupport/lib/active_support/deprecation/behaviors.rb @@ -43,7 +43,7 @@ module ActiveSupport deprecation_horizon: deprecation_horizon) }, - silence: ->(message, callstack, deprecation_horizon, gem_name) {}, + silence: ->(message, callstack, deprecation_horizon, gem_name) { }, } # Behavior module allows to determine how to display deprecation messages. diff --git a/activesupport/test/benchmarkable_test.rb b/activesupport/test/benchmarkable_test.rb index cb7a69cccf..59a71d99be 100644 --- a/activesupport/test/benchmarkable_test.rb +++ b/activesupport/test/benchmarkable_test.rb @@ -59,13 +59,13 @@ class BenchmarkableTest < ActiveSupport::TestCase def test_within_level logger.level = ActiveSupport::Logger::DEBUG - benchmark("included_debug_run", level: :debug) {} + benchmark("included_debug_run", level: :debug) { } assert_last_logged "included_debug_run" end def test_outside_level logger.level = ActiveSupport::Logger::ERROR - benchmark("skipped_debug_run", level: :debug) {} + benchmark("skipped_debug_run", level: :debug) { } assert_no_match(/skipped_debug_run/, buffer.last) ensure logger.level = ActiveSupport::Logger::DEBUG diff --git a/activesupport/test/cache/behaviors/cache_store_behavior.rb b/activesupport/test/cache/behaviors/cache_store_behavior.rb index f7c750c08e..30735eb0eb 100644 --- a/activesupport/test/cache/behaviors/cache_store_behavior.rb +++ b/activesupport/test/cache/behaviors/cache_store_behavior.rb @@ -424,7 +424,7 @@ module CacheStoreBehavior @events << ActiveSupport::Notifications::Event.new(*args) end assert @cache.write(key, "1", raw: true) - assert @cache.fetch(key) {} + assert @cache.fetch(key) { } assert_equal 1, @events.length assert_equal "cache_read.active_support", @events[0].name assert_equal :fetch, @events[0].payload[:super_operation] @@ -438,7 +438,7 @@ module CacheStoreBehavior ActiveSupport::Notifications.subscribe(/^cache_(.*)\.active_support$/) do |*args| @events << ActiveSupport::Notifications::Event.new(*args) end - assert_not @cache.fetch("bad_key") {} + assert_not @cache.fetch("bad_key") { } assert_equal 3, @events.length assert_equal "cache_read.active_support", @events[0].name assert_equal "cache_generate.active_support", @events[1].name diff --git a/activesupport/test/cache/local_cache_middleware_test.rb b/activesupport/test/cache/local_cache_middleware_test.rb index e59fae0b4c..e46fa59784 100644 --- a/activesupport/test/cache/local_cache_middleware_test.rb +++ b/activesupport/test/cache/local_cache_middleware_test.rb @@ -17,7 +17,7 @@ module ActiveSupport }) _, _, body = middleware.call({}) assert LocalCacheRegistry.cache_for(key), "should still have a cache" - body.each {} + body.each { } assert LocalCacheRegistry.cache_for(key), "should still have a cache" body.close assert_nil LocalCacheRegistry.cache_for(key) diff --git a/activesupport/test/callbacks_test.rb b/activesupport/test/callbacks_test.rb index 5c9a3b29e7..466b364e9d 100644 --- a/activesupport/test/callbacks_test.rb +++ b/activesupport/test/callbacks_test.rb @@ -953,7 +953,7 @@ module CallbacksTest def test_proc_arity_2 assert_raises(ArgumentError) do - klass = build_class(->(x, y) {}) + klass = build_class(->(x, y) { }) klass.new.run end end @@ -1032,7 +1032,7 @@ module CallbacksTest def test_proc_arity2 assert_raises(ArgumentError) do - object = build_class(->(a, b) {}).new + object = build_class(->(a, b) { }).new object.run end end diff --git a/activesupport/test/core_ext/array/extract_test.rb b/activesupport/test/core_ext/array/extract_test.rb index 200727667c..f26e055033 100644 --- a/activesupport/test/core_ext/array/extract_test.rb +++ b/activesupport/test/core_ext/array/extract_test.rb @@ -35,7 +35,7 @@ class ExtractTest < ActiveSupport::TestCase empty_array = [] array_id = empty_array.object_id - new_empty_array = empty_array.extract! {} + new_empty_array = empty_array.extract! { } assert_equal [], new_empty_array assert_equal [], empty_array diff --git a/activesupport/test/core_ext/module/concerning_test.rb b/activesupport/test/core_ext/module/concerning_test.rb index 374114c11b..38fd60463d 100644 --- a/activesupport/test/core_ext/module/concerning_test.rb +++ b/activesupport/test/core_ext/module/concerning_test.rb @@ -5,7 +5,7 @@ require "active_support/core_ext/module/concerning" class ModuleConcerningTest < ActiveSupport::TestCase def test_concerning_declares_a_concern_and_includes_it_immediately - klass = Class.new { concerning(:Foo) {} } + klass = Class.new { concerning(:Foo) { } } assert_includes klass.ancestors, klass::Foo, klass.ancestors.inspect end end diff --git a/activesupport/test/core_ext/range_ext_test.rb b/activesupport/test/core_ext/range_ext_test.rb index 7c7a78f461..4b8efb8a93 100644 --- a/activesupport/test/core_ext/range_ext_test.rb +++ b/activesupport/test/core_ext/range_ext_test.rb @@ -108,14 +108,14 @@ class RangeTest < ActiveSupport::TestCase def test_each_on_time_with_zone twz = ActiveSupport::TimeWithZone.new(nil, ActiveSupport::TimeZone["Eastern Time (US & Canada)"], Time.utc(2006, 11, 28, 10, 30)) assert_raises TypeError do - ((twz - 1.hour)..twz).each {} + ((twz - 1.hour)..twz).each { } end end def test_step_on_time_with_zone twz = ActiveSupport::TimeWithZone.new(nil, ActiveSupport::TimeZone["Eastern Time (US & Canada)"], Time.utc(2006, 11, 28, 10, 30)) assert_raises TypeError do - ((twz - 1.hour)..twz).step(1) {} + ((twz - 1.hour)..twz).step(1) { } end end @@ -131,11 +131,11 @@ class RangeTest < ActiveSupport::TestCase def test_date_time_with_each datetime = DateTime.now - assert(((datetime - 1.hour)..datetime).each {}) + assert(((datetime - 1.hour)..datetime).each { }) end def test_date_time_with_step datetime = DateTime.now - assert(((datetime - 1.hour)..datetime).step(1) {}) + assert(((datetime - 1.hour)..datetime).step(1) { }) end end diff --git a/activesupport/test/core_ext/time_with_zone_test.rb b/activesupport/test/core_ext/time_with_zone_test.rb index e650209268..f6e836e446 100644 --- a/activesupport/test/core_ext/time_with_zone_test.rb +++ b/activesupport/test/core_ext/time_with_zone_test.rb @@ -1105,7 +1105,7 @@ class TimeWithZoneMethodsForTimeAndDateTimeTest < ActiveSupport::TestCase def test_use_zone_raises_on_invalid_timezone Time.zone = "Alaska" assert_raise ArgumentError do - Time.use_zone("No such timezone exists") {} + Time.use_zone("No such timezone exists") { } end assert_equal ActiveSupport::TimeZone["Alaska"], Time.zone end diff --git a/activesupport/test/dependencies_test.rb b/activesupport/test/dependencies_test.rb index a486ef5eac..e144971e9f 100644 --- a/activesupport/test/dependencies_test.rb +++ b/activesupport/test/dependencies_test.rb @@ -816,7 +816,7 @@ class DependenciesTest < ActiveSupport::TestCase end def test_new_contants_in_without_constants - assert_equal [], (ActiveSupport::Dependencies.new_constants_in(Object) {}) + assert_equal [], (ActiveSupport::Dependencies.new_constants_in(Object) { }) assert ActiveSupport::Dependencies.constant_watch_stack.all? { |k, v| v.empty? } end @@ -892,7 +892,7 @@ class DependenciesTest < ActiveSupport::TestCase def test_new_constants_in_with_illegal_module_name_raises_correct_error assert_raise(NameError) do - ActiveSupport::Dependencies.new_constants_in("Illegal-Name") {} + ActiveSupport::Dependencies.new_constants_in("Illegal-Name") { } end end diff --git a/activesupport/test/evented_file_update_checker_test.rb b/activesupport/test/evented_file_update_checker_test.rb index d3af0dbef3..a557608986 100644 --- a/activesupport/test/evented_file_update_checker_test.rb +++ b/activesupport/test/evented_file_update_checker_test.rb @@ -38,7 +38,7 @@ class EventedFileUpdateCheckerTest < ActiveSupport::TestCase FileUtils.touch(tmpfiles) - checker = new_checker(tmpfiles) {} + checker = new_checker(tmpfiles) { } assert_not_predicate checker, :updated? # Pipes used for flow control across fork. diff --git a/activesupport/test/executor_test.rb b/activesupport/test/executor_test.rb index af441064dd..3026f002c3 100644 --- a/activesupport/test/executor_test.rb +++ b/activesupport/test/executor_test.rb @@ -23,7 +23,7 @@ class ExecutorTest < ActiveSupport::TestCase executor.to_run { @foo = true } executor.to_complete { result = @foo } - executor.wrap {} + executor.wrap { } assert result end @@ -85,7 +85,7 @@ class ExecutorTest < ActiveSupport::TestCase executor.register_hook(hook) - executor.wrap {} + executor.wrap { } assert_equal :some_state, supplied_state end @@ -105,7 +105,7 @@ class ExecutorTest < ActiveSupport::TestCase executor.register_hook(hook) - executor.wrap {} + executor.wrap { } assert_nil supplied_state end @@ -129,7 +129,7 @@ class ExecutorTest < ActiveSupport::TestCase executor.register_hook(hook) assert_raises(DummyError) do - executor.wrap {} + executor.wrap { } end assert_equal :none, supplied_state @@ -154,7 +154,7 @@ class ExecutorTest < ActiveSupport::TestCase end assert_raises(DummyError) do - executor.wrap {} + executor.wrap { } end assert_equal :some_state, supplied_state @@ -187,7 +187,7 @@ class ExecutorTest < ActiveSupport::TestCase executor.register_hook(hook_class.new(:c), outer: true) executor.register_hook(hook_class.new(:d)) - executor.wrap {} + executor.wrap { } assert_equal [:run_c, :run_a, :run_b, :run_d, :complete_a, :complete_b, :complete_d, :complete_c], invoked assert_equal [:state_a, :state_b, :state_d, :state_c], supplied_state @@ -209,9 +209,9 @@ class ExecutorTest < ActiveSupport::TestCase executor.register_hook(hook) before = RubyVM.stat(:class_serial) - executor.wrap {} - executor.wrap {} - executor.wrap {} + executor.wrap { } + executor.wrap { } + executor.wrap { } after = RubyVM.stat(:class_serial) assert_equal before, after diff --git a/activesupport/test/notifications_test.rb b/activesupport/test/notifications_test.rb index 62817a839a..54fd4345fb 100644 --- a/activesupport/test/notifications_test.rb +++ b/activesupport/test/notifications_test.rb @@ -90,7 +90,7 @@ module Notifications ActiveSupport::Notifications.subscribe("foo", TestSubscriber.new) ActiveSupport::Notifications.instrument("foo") do - ActiveSupport::Notifications.subscribe("foo") {} + ActiveSupport::Notifications.subscribe("foo") { } end ensure ActiveSupport::Notifications.notifier = old_notifier diff --git a/activesupport/test/reloader_test.rb b/activesupport/test/reloader_test.rb index 976917c1a1..1b7cc253d9 100644 --- a/activesupport/test/reloader_test.rb +++ b/activesupport/test/reloader_test.rb @@ -35,13 +35,13 @@ class ReloaderTest < ActiveSupport::TestCase r = new_reloader { true } invoked = false r.to_run { invoked = true } - r.wrap {} + r.wrap { } assert invoked r = new_reloader { false } invoked = false r.to_run { invoked = true } - r.wrap {} + r.wrap { } assert_not invoked end @@ -53,7 +53,7 @@ class ReloaderTest < ActiveSupport::TestCase reloader.executor.to_run { called << :executor_run } reloader.executor.to_complete { called << :executor_complete } - reloader.wrap {} + reloader.wrap { } assert_equal [:executor_run, :reloader_run, :prepare, :reloader_complete, :executor_complete], called called = [] @@ -63,7 +63,7 @@ class ReloaderTest < ActiveSupport::TestCase reloader.check = lambda { false } called = [] - reloader.wrap {} + reloader.wrap { } assert_equal [:executor_run, :executor_complete], called called = [] diff --git a/activesupport/test/share_lock_test.rb b/activesupport/test/share_lock_test.rb index 42fd5eefc1..34479020e1 100644 --- a/activesupport/test/share_lock_test.rb +++ b/activesupport/test/share_lock_test.rb @@ -11,29 +11,29 @@ class ShareLockTest < ActiveSupport::TestCase def test_reentrancy thread = Thread.new do - @lock.sharing { @lock.sharing {} } - @lock.exclusive { @lock.exclusive {} } + @lock.sharing { @lock.sharing { } } + @lock.exclusive { @lock.exclusive { } } end assert_threads_not_stuck thread end def test_sharing_doesnt_block with_thread_waiting_in_lock_section(:sharing) do |sharing_thread_latch| - assert_threads_not_stuck(Thread.new { @lock.sharing {} }) + assert_threads_not_stuck(Thread.new { @lock.sharing { } }) end end def test_sharing_blocks_exclusive with_thread_waiting_in_lock_section(:sharing) do |sharing_thread_release_latch| @lock.exclusive(no_wait: true) { flunk } # polling should fail - exclusive_thread = Thread.new { @lock.exclusive {} } + exclusive_thread = Thread.new { @lock.exclusive { } } assert_threads_stuck_but_releasable_by_latch exclusive_thread, sharing_thread_release_latch end end def test_exclusive_blocks_sharing with_thread_waiting_in_lock_section(:exclusive) do |exclusive_thread_release_latch| - sharing_thread = Thread.new { @lock.sharing {} } + sharing_thread = Thread.new { @lock.sharing { } } assert_threads_stuck_but_releasable_by_latch sharing_thread, exclusive_thread_release_latch end end @@ -42,7 +42,7 @@ class ShareLockTest < ActiveSupport::TestCase with_thread_waiting_in_lock_section(:sharing) do |sharing_thread_release_latch| exclusive_threads = (1..2).map do Thread.new do - @lock.exclusive {} + @lock.exclusive { } end end @@ -53,7 +53,7 @@ class ShareLockTest < ActiveSupport::TestCase def test_sharing_is_upgradeable_to_exclusive upgrading_thread = Thread.new do @lock.sharing do - @lock.exclusive {} + @lock.exclusive { } end end assert_threads_not_stuck upgrading_thread @@ -66,7 +66,7 @@ class ShareLockTest < ActiveSupport::TestCase upgrading_thread = Thread.new do @lock.sharing do in_sharing.count_down - @lock.exclusive {} + @lock.exclusive { } end end @@ -81,7 +81,7 @@ class ShareLockTest < ActiveSupport::TestCase exclusive_threads = (1..2).map do Thread.new do @lock.send(use_upgrading ? :sharing : :tap) do - @lock.exclusive(purpose: :load, compatible: [:load, :unload]) {} + @lock.exclusive(purpose: :load, compatible: [:load, :unload]) { } end end end @@ -95,7 +95,7 @@ class ShareLockTest < ActiveSupport::TestCase with_thread_waiting_in_lock_section(:sharing) do |sharing_thread_release_latch| thread = Thread.new do @lock.sharing do - @lock.exclusive {} + @lock.exclusive { } end end @@ -105,7 +105,7 @@ class ShareLockTest < ActiveSupport::TestCase sharing_thread_release_latch.count_down thread = Thread.new do - @lock.exclusive {} + @lock.exclusive { } end assert_threads_not_stuck thread @@ -121,13 +121,13 @@ class ShareLockTest < ActiveSupport::TestCase Thread.new do @lock.send(use_upgrading ? :sharing : :tap) do together.wait - @lock.exclusive(purpose: :red, compatible: [:green, :purple]) {} + @lock.exclusive(purpose: :red, compatible: [:green, :purple]) { } end end, Thread.new do @lock.send(use_upgrading ? :sharing : :tap) do together.wait - @lock.exclusive(purpose: :blue, compatible: [:green]) {} + @lock.exclusive(purpose: :blue, compatible: [:green]) { } end end ] @@ -138,7 +138,7 @@ class ShareLockTest < ActiveSupport::TestCase # a sharing block. While it's blocked, it holds no lock, so it # doesn't interfere with any other attempts. no_purpose_thread = Thread.new do - @lock.exclusive {} + @lock.exclusive { } end assert_threads_stuck no_purpose_thread @@ -147,7 +147,7 @@ class ShareLockTest < ActiveSupport::TestCase # lock, but as soon as that's released, it can run -- # regardless of whether those threads hold share locks. compatible_thread = Thread.new do - @lock.exclusive(purpose: :green, compatible: []) {} + @lock.exclusive(purpose: :green, compatible: []) { } end assert_threads_stuck compatible_thread @@ -231,7 +231,7 @@ class ShareLockTest < ActiveSupport::TestCase assert_threads_stuck waiting_exclusive late_share_attempt = Thread.new do - @lock.sharing {} + @lock.sharing { } end assert_threads_stuck late_share_attempt @@ -252,14 +252,14 @@ class ShareLockTest < ActiveSupport::TestCase @lock.sharing do ready.wait attempt_reentrancy.wait - @lock.sharing {} + @lock.sharing { } end end exclusive = Thread.new do @lock.sharing do ready.wait - @lock.exclusive {} + @lock.exclusive { } end end @@ -280,7 +280,7 @@ class ShareLockTest < ActiveSupport::TestCase Thread.new do @lock.sharing do ready.wait - @lock.exclusive(purpose: :x, compatible: [:x], after_compatible: [:x]) {} + @lock.exclusive(purpose: :x, compatible: [:x], after_compatible: [:x]) { } done.wait end end @@ -297,7 +297,7 @@ class ShareLockTest < ActiveSupport::TestCase Thread.new do @lock.sharing do ready.wait - @lock.exclusive(purpose: :x) {} + @lock.exclusive(purpose: :x) { } done.wait end end, @@ -323,7 +323,7 @@ class ShareLockTest < ActiveSupport::TestCase Thread.new do @lock.sharing do ready.wait - @lock.exclusive(purpose: :x) {} + @lock.exclusive(purpose: :x) { } done.wait end end, @@ -352,7 +352,7 @@ class ShareLockTest < ActiveSupport::TestCase Thread.new do @lock.sharing do ready.wait - @lock.exclusive(purpose: :x) {} + @lock.exclusive(purpose: :x) { } done.wait end end, @@ -386,7 +386,7 @@ class ShareLockTest < ActiveSupport::TestCase incompatible_thread = Thread.new do @lock.sharing do ready.wait - @lock.exclusive(purpose: :x) {} + @lock.exclusive(purpose: :x) { } end end @@ -418,7 +418,7 @@ class ShareLockTest < ActiveSupport::TestCase incompatible_thread = Thread.new do ready.wait - @lock.exclusive(purpose: :z) {} + @lock.exclusive(purpose: :z) { } end recursive_yield_shares_thread = Thread.new do @@ -427,7 +427,7 @@ class ShareLockTest < ActiveSupport::TestCase @lock.yield_shares(compatible: [:y]) do do_nesting.wait @lock.sharing do - @lock.yield_shares(compatible: [:x, :y]) {} + @lock.yield_shares(compatible: [:x, :y]) { } end after_nesting.wait end @@ -439,12 +439,12 @@ class ShareLockTest < ActiveSupport::TestCase assert_threads_stuck incompatible_thread compatible_thread = Thread.new do - @lock.exclusive(purpose: :y) {} + @lock.exclusive(purpose: :y) { } end assert_threads_not_stuck compatible_thread post_nesting_incompatible_thread = Thread.new do - @lock.exclusive(purpose: :x) {} + @lock.exclusive(purpose: :x) { } end assert_threads_stuck post_nesting_incompatible_thread diff --git a/railties/lib/rails/test_unit/runner.rb b/railties/lib/rails/test_unit/runner.rb index 6332a9d422..d38952bb30 100644 --- a/railties/lib/rails/test_unit/runner.rb +++ b/railties/lib/rails/test_unit/runner.rb @@ -12,8 +12,8 @@ module Rails class << self def attach_before_load_options(opts) - opts.on("--warnings", "-w", "Run with Ruby warnings enabled") {} - opts.on("-e", "--environment ENV", "Run tests in the ENV environment") {} + opts.on("--warnings", "-w", "Run with Ruby warnings enabled") { } + opts.on("-e", "--environment ENV", "Run tests in the ENV environment") { } end def parse_options(argv) diff --git a/railties/test/rack_logger_test.rb b/railties/test/rack_logger_test.rb index 6e8f333e1d..ac37062e6d 100644 --- a/railties/test/rack_logger_test.rb +++ b/railties/test/rack_logger_test.rb @@ -56,7 +56,7 @@ module Rails end def test_notification - logger = TestLogger.new {} + logger = TestLogger.new { } assert_difference("subscriber.starts.length") do assert_difference("subscriber.finishes.length") do -- cgit v1.2.3