Skip to content

Commit c20644e

Browse files
committed
Switch SpaceInsideHashLiteralBraces to no_space
1 parent 684e2a3 commit c20644e

19 files changed

+37
-37
lines changed

.rubocop.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ Layout/ParameterAlignment:
6666

6767
Layout/SpaceInsideHashLiteralBraces:
6868
EnforcedStyle: no_space
69-
EnforcedStyleForEmptyBraces: space
69+
EnforcedStyleForEmptyBraces: no_space
7070

7171
Layout/SpaceInsidePercentLiteralDelimiters:
7272
Enabled: false

example_app_generator/no_active_record/app/models/in_memory/model.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def find(id)
2121
all.find { |record| record.id == id } || raise
2222
end
2323

24-
def create!(attributes = { })
24+
def create!(attributes = {})
2525
record = new(attributes)
2626
record.save
2727
record
@@ -43,7 +43,7 @@ class Model
4343
include ::ActiveModel::Conversion
4444
include ::ActiveModel::Validations
4545

46-
def initialize(attributes = { })
46+
def initialize(attributes = {})
4747
assign_attributes(attributes)
4848
end
4949
end

example_app_generator/spec/verify_custom_renderers_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ def index
138138
class MyResolver < ActionView::Resolver
139139
private
140140

141-
def find_templates(name, prefix = nil, partial = false, _details = { }, _key = nil, _locals = [])
141+
def find_templates(name, prefix = nil, partial = false, _details = {}, _key = nil, _locals = [])
142142
name.prepend("_") if partial
143143
path = [prefix, name].join("/")
144144
template = find_template(name, path)

example_app_generator/spec/verify_mailer_preview_path_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def ==(str)
1010

1111
def as_commandline(ops)
1212
cmd, ops = ops.reverse
13-
ops ||= { }
13+
ops ||= {}
1414
cmd_parts = ops.map { |k, v| "#{k}=#{v}" } << cmd << '2>&1'
1515
cmd_parts.join(' ')
1616
end

lib/generators/rspec/scaffold/scaffold_generator.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def raw_value_for(attribute)
109109
when :string
110110
attribute.name.titleize
111111
when :integer, :float
112-
@attribute_id_map ||= { }
112+
@attribute_id_map ||= {}
113113
@attribute_id_map[attribute] ||= @attribute_id_map.keys.size.next + attribute.default
114114
else
115115
attribute.default

lib/rspec/rails/example/view_example_group.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ module ViewExampleGroup
1616
# @private
1717
module StubResolverCache
1818
def self.resolver_for(hash)
19-
@resolvers ||= { }
19+
@resolvers ||= {}
2020
@resolvers[hash] ||= ActionView::FixtureResolver.new(hash)
2121
end
2222
end
@@ -63,7 +63,7 @@ module ExampleMethods
6363
# # ...
6464
# end
6565
# end
66-
def render(options = { }, local_assigns = { }, &block)
66+
def render(options = {}, local_assigns = {}, &block)
6767
options = _default_render_options if Hash === options && options.empty?
6868
super(options, local_assigns, &block)
6969
end
@@ -189,7 +189,7 @@ def _include_controller_helpers
189189

190190
controller.controller_path = _controller_path
191191

192-
path_params_to_merge = { }
192+
path_params_to_merge = {}
193193
path_params_to_merge[:controller] = _controller_path
194194
path_params_to_merge[:action] = _inferred_action unless _inferred_action =~ /^_/
195195

lib/rspec/rails/matchers/be_a_new.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def failure_message
4545
private
4646

4747
def attributes
48-
@attributes ||= { }
48+
@attributes ||= {}
4949
end
5050

5151
def attributes_match?(actual)

lib/rspec/rails/matchers/have_http_status.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def as_test_response(obj)
4646
resp.headers.clear
4747
resp.headers.merge!(obj.response_headers)
4848
resp.body = obj.body
49-
resp.request = ActionDispatch::Request.new({ })
49+
resp.request = ActionDispatch::Request.new({})
5050
end
5151
::ActionDispatch::TestResponse.from_response(obj)
5252
else

lib/rspec/rails/matchers/routing_matchers.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ module RoutingMatchers
99
class RouteToMatcher < RSpec::Rails::Matchers::BaseMatcher
1010
def initialize(scope, *expected)
1111
@scope = scope
12-
@expected = expected[1] || { }
12+
@expected = expected[1] || {}
1313
if Hash === expected[0]
1414
@expected.merge!(expected[0])
1515
else

lib/rspec/rails/view_assigns.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def _assigns
3838
private
3939

4040
def _encapsulated_assigns
41-
@_encapsulated_assigns ||= { }
41+
@_encapsulated_assigns ||= {}
4242
end
4343
end
4444
end

lib/rspec/rails/view_spec_methods.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def extra_params=(hash)
3838
# controller.extra_params
3939
# # => { :id => 4 }
4040
def extra_params
41-
@extra_params ||= { }
41+
@extra_params ||= {}
4242
@extra_params.dup.freeze
4343
end
4444
end

spec/rspec/rails/configuration_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
end
2121

2222
shared_examples_for "adds setting" do |accessor, opts|
23-
opts ||= { }
23+
opts ||= {}
2424
default_value = opts[:default]
2525
alias_setting = opts[:alias_with]
2626
query_method = "#{accessor}?".to_sym

spec/rspec/rails/example/mailer_example_group_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module ::Rails; end
44
before do
55
allow(Rails).to receive_message_chain(:application, :routes, :url_helpers).and_return(Rails)
66
allow(Rails.application).to receive(:config).and_return(double("Rails.application.config").as_null_object)
7-
allow(Rails).to receive_message_chain(:configuration, :action_mailer, :default_url_options).and_return({ })
7+
allow(Rails).to receive_message_chain(:configuration, :action_mailer, :default_url_options).and_return({})
88
end
99

1010
it_behaves_like "an rspec-rails example group mixin", :mailer,

spec/rspec/rails/example/view_example_group_spec.rb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,11 @@ def self.helper(*); end # Stub method
123123
def received
124124
@received ||= []
125125
end
126-
def render(options = { }, local_assigns = { }, &block)
126+
def render(options = {}, local_assigns = {}, &block)
127127
received << [options, local_assigns, block]
128128
end
129129
def _assigns
130-
{ }
130+
{}
131131
end
132132
end
133133
include local
@@ -140,39 +140,39 @@ def _default_file_to_render; end # Stub method
140140
it "sends render(:template => (described file)) to the view" do
141141
allow(view_spec).to receive(:_default_file_to_render) { "widgets/new" }
142142
view_spec.render
143-
expect(view_spec.received.first).to eq([{template: "widgets/new"}, { }, nil])
143+
expect(view_spec.received.first).to eq([{template: "widgets/new"}, {}, nil])
144144
end
145145

146146
it "converts the filename components into render options" do
147147
allow(view_spec).to receive(:_default_file_to_render) { "widgets/new.en.html.erb" }
148148
view_spec.render
149-
expect(view_spec.received.first).to eq([{template: "widgets/new", locales: ['en'], formats: [:html], handlers: ['erb']}, { }, nil])
149+
expect(view_spec.received.first).to eq([{template: "widgets/new", locales: ['en'], formats: [:html], handlers: ['erb']}, {}, nil])
150150
end
151151

152152
it "converts the filename with variant into render options" do
153153
allow(view_spec).to receive(:_default_file_to_render) { "widgets/new.en.html+fancy.erb" }
154154
view_spec.render
155-
expect(view_spec.received.first).to eq([{template: "widgets/new", locales: ['en'], formats: [:html], handlers: ['erb'], variants: ['fancy']}, { }, nil])
155+
expect(view_spec.received.first).to eq([{template: "widgets/new", locales: ['en'], formats: [:html], handlers: ['erb'], variants: ['fancy']}, {}, nil])
156156
end
157157

158158
it "converts the filename without format into render options" do
159159
allow(view_spec).to receive(:_default_file_to_render) { "widgets/new.en.erb" }
160160
view_spec.render
161-
expect(view_spec.received.first).to eq([{template: "widgets/new", locales: ['en'], handlers: ['erb']}, { }, nil])
161+
expect(view_spec.received.first).to eq([{template: "widgets/new", locales: ['en'], handlers: ['erb']}, {}, nil])
162162
end
163163
end
164164

165165
context "given a string" do
166166
it "sends string as the first arg to render" do
167167
view_spec.render('arbitrary/path')
168-
expect(view_spec.received.first).to eq(["arbitrary/path", { }, nil])
168+
expect(view_spec.received.first).to eq(["arbitrary/path", {}, nil])
169169
end
170170
end
171171

172172
context "given a hash" do
173173
it "sends the hash as the first arg to render" do
174174
view_spec.render(foo: 'bar')
175-
expect(view_spec.received.first).to eq([{foo: "bar"}, { }, nil])
175+
expect(view_spec.received.first).to eq([{foo: "bar"}, {}, nil])
176176
end
177177
end
178178
end
@@ -188,7 +188,7 @@ def controller
188188
end
189189

190190
it 'delegates to the controller' do
191-
expect(view_spec.controller).to receive(:params).and_return({ })
191+
expect(view_spec.controller).to receive(:params).and_return({})
192192
view_spec.params[:foo] = 1
193193
end
194194
end

spec/rspec/rails/matchers/action_cable/have_broadcasted_to_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def initialize(id)
1212
@id = id
1313
end
1414

15-
def to_global_id(_options = { })
15+
def to_global_id(_options = {})
1616
@global_id ||= GlobalID.create(self, app: "rspec-suite")
1717
end
1818
end

spec/rspec/rails/matchers/active_job_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def ==(comparison_object)
2020
(GlobalIdModel === comparison_object) && (id == comparison_object.id)
2121
end
2222

23-
def to_global_id(_options = { })
23+
def to_global_id(_options = {})
2424
@global_id ||= GlobalID.create(self, app: "rspec-suite")
2525
end
2626
end

spec/rspec/rails/matchers/be_routable_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
context "with should" do
1212
it "passes if routes recognize the path" do
13-
allow(routes).to receive(:recognize_path) { { } }
13+
allow(routes).to receive(:recognize_path) { {} }
1414
expect do
1515
expect({get: "/a/path"}).to be_routable
1616
end.to_not raise_error

spec/rspec/rails/matchers/have_http_status_spec.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
RSpec.describe "have_http_status" do
2-
def create_response(opts = { })
2+
def create_response(opts = {})
33
ActionDispatch::TestResponse.new(opts.fetch(:status)).tap { |x|
4-
x.request = ActionDispatch::Request.new({ })
4+
x.request = ActionDispatch::Request.new({})
55
}
66
end
77

88
shared_examples_for "supports different response instances" do
99
context "given an ActionDispatch::Response" do
1010
it "returns true for a response with the same code" do
1111
response = ::ActionDispatch::Response.new(code).tap { |x|
12-
x.request = ActionDispatch::Request.new({ })
12+
x.request = ActionDispatch::Request.new({})
1313
}
1414

1515
expect(matcher.matches?(response)).to be(true)
@@ -19,7 +19,7 @@ def create_response(opts = { })
1919
context "given an ActionDispatch::TestResponse" do
2020
it "returns true for a response with the same code" do
2121
response = ::ActionDispatch::TestResponse.new(code).tap { |x|
22-
x.request = ActionDispatch::Request.new({ })
22+
x.request = ActionDispatch::Request.new({})
2323
}
2424

2525
expect(matcher.matches?(response)).to be(true)
@@ -31,7 +31,7 @@ def create_response(opts = { })
3131
response = instance_double(
3232
'::Capybara::Session',
3333
status_code: code,
34-
response_headers: { },
34+
response_headers: {},
3535
body: ""
3636
)
3737

@@ -440,7 +440,7 @@ def create_response(opts = { })
440440
splitter = RSpec::Support::StdErrSplitter.new(previous_stderr)
441441
$stderr = splitter
442442
response = ::ActionDispatch::Response.new(code).tap { |x|
443-
x.request = ActionDispatch::Request.new({ })
443+
x.request = ActionDispatch::Request.new({})
444444
}
445445
expect(matcher.matches?(response)).to be(true)
446446
expect(splitter.has_output?).to be false

spec/rspec/rails/matchers/route_to_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,21 @@ def assert_recognizes(*)
1313
end
1414

1515
it "delegates to assert_recognizes" do
16-
expect(self).to receive(:assert_recognizes).with({"these" => "options"}, {method: :get, path: "path"}, { })
16+
expect(self).to receive(:assert_recognizes).with({"these" => "options"}, {method: :get, path: "path"}, {})
1717
expect({get: "path"}).to route_to("these" => "options")
1818
end
1919

2020
context "with shortcut syntax" do
2121
it "routes with extra options" do
22-
expect(self).to receive(:assert_recognizes).with({controller: "controller", action: "action", extra: "options"}, {method: :get, path: "path"}, { })
22+
expect(self).to receive(:assert_recognizes).with({controller: "controller", action: "action", extra: "options"}, {method: :get, path: "path"}, {})
2323
expect(get("path")).to route_to("controller#action", extra: "options")
2424
end
2525

2626
it "routes without extra options" do
2727
expect(self).to receive(:assert_recognizes).with(
2828
{controller: "controller", action: "action"},
2929
{method: :get, path: "path"},
30-
{ }
30+
{}
3131
)
3232
expect(get("path")).to route_to("controller#action")
3333
end

0 commit comments

Comments
 (0)