Skip to content

Commit f679933

Browse files
committed
Change the empty block style to have space inside of the block
1 parent d34bd0d commit f679933

File tree

60 files changed

+142
-141
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+142
-141
lines changed

.rubocop.yml

+1
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ Layout/SpaceBeforeBlockBraces:
137137
# Use `foo { bar }` not `foo {bar}`.
138138
Layout/SpaceInsideBlockBraces:
139139
Enabled: true
140+
EnforcedStyleForEmptyBraces: space
140141

141142
# Use `{ a: 1 }` not `{a:1}`.
142143
Layout/SpaceInsideHashLiteralBraces:

actionmailer/test/assert_select_email_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def test(options)
2525

2626
def test_assert_select_email
2727
assert_raise ActiveSupport::TestCase::Assertion do
28-
assert_select_email {}
28+
assert_select_email { }
2929
end
3030

3131
AssertSelectMailer.test("<div><p>foo</p><p>bar</p></div>").deliver_now

actionpack/test/controller/base_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ def test_response_has_default_headers
138138

139139
response_headers = SimpleController.action("hello").call(
140140
"REQUEST_METHOD" => "GET",
141-
"rack.input" => -> {}
141+
"rack.input" => -> { }
142142
)[1]
143143

144144
assert response_headers.key?("X-Frame-Options")

actionpack/test/controller/live_stream_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ def test_delayed_autoload_after_write_within_interlock_hook
304304
# Simulate InterlockHook
305305
ActiveSupport::Dependencies.interlock.start_running
306306
res = get :write_sleep_autoload
307-
res.each {}
307+
res.each { }
308308
ActiveSupport::Dependencies.interlock.done_running
309309
end
310310

actionpack/test/controller/metal_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def test_response_does_not_have_default_headers
2020

2121
response_headers = SimpleController.action("hello").call(
2222
"REQUEST_METHOD" => "GET",
23-
"rack.input" => -> {}
23+
"rack.input" => -> { }
2424
)[1]
2525

2626
assert_not response_headers.key?("X-Frame-Options")

actionpack/test/controller/mime/respond_to_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def using_defaults
7878
def missing_templates
7979
respond_to do |type|
8080
# This test requires a block that is empty
81-
type.json {}
81+
type.json { }
8282
type.xml
8383
end
8484
end

actionpack/test/controller/routing_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ def test_non_greedy_glob_regexp
309309

310310
def test_specific_controller_action_failure
311311
rs.draw do
312-
mount lambda {} => "/foo"
312+
mount lambda { } => "/foo"
313313
end
314314

315315
assert_raises(ActionController::UrlGenerationError) do

actionpack/test/dispatch/middleware_stack_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def test_delete_works
4242
end
4343

4444
test "use should push middleware class with block arguments onto the stack" do
45-
proc = Proc.new {}
45+
proc = Proc.new { }
4646
assert_difference "@stack.size" do
4747
@stack.use(BlockMiddleware, &proc)
4848
end

actionpack/test/dispatch/request_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def url_for(options = {})
2424
def stub_request(env = {})
2525
ip_spoofing_check = env.key?(:ip_spoofing_check) ? env.delete(:ip_spoofing_check) : true
2626
@trusted_proxies ||= nil
27-
ip_app = ActionDispatch::RemoteIp.new(Proc.new {}, ip_spoofing_check, @trusted_proxies)
27+
ip_app = ActionDispatch::RemoteIp.new(Proc.new { }, ip_spoofing_check, @trusted_proxies)
2828
ActionDispatch::Http::URL.tld_length = env.delete(:tld_length) if env.key?(:tld_length)
2929

3030
ip_app.call(env)

actionpack/test/dispatch/routing/inspector_test.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ def test_no_routes_matched_filter_when_expanded
373373
end
374374

375375
def test_not_routes_when_expanded
376-
output = draw(grep: "rails/dummy", formatter: ActionDispatch::Routing::ConsoleFormatter::Expanded.new) {}
376+
output = draw(grep: "rails/dummy", formatter: ActionDispatch::Routing::ConsoleFormatter::Expanded.new) { }
377377

378378
assert_equal [
379379
"You don't have any routes defined!",
@@ -450,7 +450,7 @@ def test_no_routes_matched_filter
450450
end
451451

452452
def test_no_routes_were_defined
453-
output = draw(grep: "Rails::DummyController") {}
453+
output = draw(grep: "Rails::DummyController") { }
454454

455455
assert_equal [
456456
"You don't have any routes defined!",
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
22

33
module FooHelper
4-
redefine_method(:baz) {}
4+
redefine_method(:baz) { }
55
end

actionview/test/activerecord/debug_helper_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def test_debug
1313
end
1414

1515
def test_debug_with_marshal_error
16-
obj = -> {}
16+
obj = -> { }
1717
assert_match obj.inspect, Nokogiri.XML(debug(obj)).content
1818
end
1919
end

actionview/test/template/capture_helper_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ def test_with_output_buffer_sets_proper_encoding
219219

220220
def test_with_output_buffer_does_not_assume_there_is_an_output_buffer
221221
assert_nil @av.output_buffer
222-
assert_equal "", @av.with_output_buffer {}
222+
assert_equal "", @av.with_output_buffer { }
223223
end
224224

225225
def alt_encoding(output_buffer)

actionview/test/template/form_helper/form_with_test.rb

+8-8
Original file line numberDiff line numberDiff line change
@@ -2246,37 +2246,37 @@ def test_form_with_with_new_object
22462246
post.persisted = false
22472247
def post.to_key; nil; end
22482248

2249-
form_with(model: post) {}
2249+
form_with(model: post) { }
22502250

22512251
expected = whole_form("/posts")
22522252
assert_dom_equal expected, output_buffer
22532253
end
22542254

22552255
def test_form_with_with_existing_object_in_list
22562256
@comment.save
2257-
form_with(model: [@post, @comment]) {}
2257+
form_with(model: [@post, @comment]) { }
22582258

22592259
expected = whole_form(post_comment_path(@post, @comment), method: "patch")
22602260
assert_dom_equal expected, output_buffer
22612261
end
22622262

22632263
def test_form_with_with_new_object_in_list
2264-
form_with(model: [@post, @comment]) {}
2264+
form_with(model: [@post, @comment]) { }
22652265

22662266
expected = whole_form(post_comments_path(@post))
22672267
assert_dom_equal expected, output_buffer
22682268
end
22692269

22702270
def test_form_with_with_existing_object_and_namespace_in_list
22712271
@comment.save
2272-
form_with(model: [:admin, @post, @comment]) {}
2272+
form_with(model: [:admin, @post, @comment]) { }
22732273

22742274
expected = whole_form(admin_post_comment_path(@post, @comment), method: "patch")
22752275
assert_dom_equal expected, output_buffer
22762276
end
22772277

22782278
def test_form_with_with_new_object_and_namespace_in_list
2279-
form_with(model: [:admin, @post, @comment]) {}
2279+
form_with(model: [:admin, @post, @comment]) { }
22802280

22812281
expected = whole_form(admin_post_comments_path(@post))
22822282
assert_dom_equal expected, output_buffer
@@ -2290,13 +2290,13 @@ def test_form_with_with_existing_object_and_custom_url
22902290
end
22912291

22922292
def test_form_with_with_default_method_as_patch
2293-
form_with(model: @post) {}
2293+
form_with(model: @post) { }
22942294
expected = whole_form("/posts/123", method: "patch")
22952295
assert_dom_equal expected, output_buffer
22962296
end
22972297

22982298
def test_form_with_with_data_attributes
2299-
form_with(model: @post, data: { behavior: "stuff" }) {}
2299+
form_with(model: @post, data: { behavior: "stuff" }) { }
23002300
assert_match %r|data-behavior="stuff"|, output_buffer
23012301
assert_match %r|data-remote="true"|, output_buffer
23022302
end
@@ -2315,7 +2315,7 @@ def test_form_with_only_instantiates_builder_once
23152315
end
23162316
end
23172317

2318-
form_with(model: @post, builder: builder_class) {}
2318+
form_with(model: @post, builder: builder_class) { }
23192319
assert_equal 1, initialization_count, "form builder instantiated more than once"
23202320
end
23212321

actionview/test/template/form_helper_test.rb

+7-7
Original file line numberDiff line numberDiff line change
@@ -3488,29 +3488,29 @@ def post.to_key; nil; end
34883488

34893489
def test_form_for_with_existing_object_in_list
34903490
@comment.save
3491-
form_for([@post, @comment]) {}
3491+
form_for([@post, @comment]) { }
34923492

34933493
expected = whole_form(post_comment_path(@post, @comment), "edit_comment_1", "edit_comment", method: "patch")
34943494
assert_dom_equal expected, output_buffer
34953495
end
34963496

34973497
def test_form_for_with_new_object_in_list
3498-
form_for([@post, @comment]) {}
3498+
form_for([@post, @comment]) { }
34993499

35003500
expected = whole_form(post_comments_path(@post), "new_comment", "new_comment")
35013501
assert_dom_equal expected, output_buffer
35023502
end
35033503

35043504
def test_form_for_with_existing_object_and_namespace_in_list
35053505
@comment.save
3506-
form_for([:admin, @post, @comment]) {}
3506+
form_for([:admin, @post, @comment]) { }
35073507

35083508
expected = whole_form(admin_post_comment_path(@post, @comment), "edit_comment_1", "edit_comment", method: "patch")
35093509
assert_dom_equal expected, output_buffer
35103510
end
35113511

35123512
def test_form_for_with_new_object_and_namespace_in_list
3513-
form_for([:admin, @post, @comment]) {}
3513+
form_for([:admin, @post, @comment]) { }
35143514

35153515
expected = whole_form(admin_post_comments_path(@post), "new_comment", "new_comment")
35163516
assert_dom_equal expected, output_buffer
@@ -3524,13 +3524,13 @@ def test_form_for_with_existing_object_and_custom_url
35243524
end
35253525

35263526
def test_form_for_with_default_method_as_patch
3527-
form_for(@post) {}
3527+
form_for(@post) { }
35283528
expected = whole_form("/posts/123", "edit_post_123", "edit_post", method: "patch")
35293529
assert_dom_equal expected, output_buffer
35303530
end
35313531

35323532
def test_form_for_with_data_attributes
3533-
form_for(@post, data: { behavior: "stuff" }, remote: true) {}
3533+
form_for(@post, data: { behavior: "stuff" }, remote: true) { }
35343534
assert_match %r|data-behavior="stuff"|, output_buffer
35353535
assert_match %r|data-remote="true"|, output_buffer
35363536
end
@@ -3549,7 +3549,7 @@ def test_form_for_only_instantiates_builder_once
35493549
end
35503550
end
35513551

3552-
form_for(@post, builder: builder_class) {}
3552+
form_for(@post, builder: builder_class) { }
35533553
assert_equal 1, initialization_count, "form builder instantiated more than once"
35543554
end
35553555

actionview/test/template/form_options_helper_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@ def test_select_under_fields_for_with_block_without_options
668668
@post = Post.new
669669

670670
output_buffer = fields_for :post, @post do |f|
671-
concat(f.select(:category) {})
671+
concat(f.select(:category) { })
672672
end
673673

674674
assert_dom_equal(

actionview/test/template/test_case_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ def self.routes
242242
@routes ||= ActionDispatch::Routing::RouteSet.new
243243
end
244244

245-
routes.draw { get "bar", to: lambda {} }
245+
routes.draw { get "bar", to: lambda { } }
246246

247247
def self.call(*)
248248
end

activejob/test/cases/test_helper_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ def test_assert_enqueued_with_failure
504504

505505
assert_raise ActiveSupport::TestCase::Assertion do
506506
LoggingJob.perform_later
507-
assert_enqueued_with(job: LoggingJob) {}
507+
assert_enqueued_with(job: LoggingJob) { }
508508
end
509509

510510
error = assert_raise ActiveSupport::TestCase::Assertion do

activemodel/test/cases/callbacks_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def initialize
112112
def callback1; history << "callback1"; end
113113
def callback2; history << "callback2"; end
114114
def create
115-
run_callbacks(:create) {}
115+
run_callbacks(:create) { }
116116
self
117117
end
118118
end

activerecord/examples/performance.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ def self.email
176176
end
177177

178178
x.report "Model.log" do
179-
Exhibit.connection.send(:log, "hello", "world") {}
179+
Exhibit.connection.send(:log, "hello", "world") { }
180180
end
181181

182182
x.report "AR.execute(query)" do

activerecord/test/cases/adapters/postgresql/referential_integrity_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def test_only_catch_active_record_errors_others_bubble_up
101101
@connection.extend ProgrammerMistake
102102

103103
assert_raises ArgumentError do
104-
@connection.disable_referential_integrity {}
104+
@connection.disable_referential_integrity { }
105105
end
106106
end
107107

activerecord/test/cases/adapters/sqlite3/sqlite3_adapter_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def test_primary_key_returns_nil_for_no_pk
8787

8888
def test_connection_no_db
8989
assert_raises(ArgumentError) do
90-
Base.sqlite3_connection {}
90+
Base.sqlite3_connection { }
9191
end
9292
end
9393

activerecord/test/cases/associations/extension_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,6 @@ def test_association_with_default_scope
8989
private
9090

9191
def extend!(model)
92-
ActiveRecord::Associations::Builder::HasMany.define_extensions(model, :association_name) {}
92+
ActiveRecord::Associations::Builder::HasMany.define_extensions(model, :association_name) { }
9393
end
9494
end

activerecord/test/cases/associations_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def test_should_construct_new_finder_sql_after_create
8080
def test_force_reload
8181
firm = Firm.new("name" => "A New Firm, Inc")
8282
firm.save
83-
firm.clients.each {} # forcing to load all clients
83+
firm.clients.each { } # forcing to load all clients
8484
assert firm.clients.empty?, "New firm shouldn't have client objects"
8585
assert_equal 0, firm.clients.size, "New firm should have 0 clients"
8686

0 commit comments

Comments
 (0)