Skip to content

Commit 3373209

Browse files
committed
Layout/SpaceInsideBlockBraces
1 parent b0be6f0 commit 3373209

File tree

11 files changed

+48
-48
lines changed

11 files changed

+48
-48
lines changed

benchmarks/before_block_capture_block_vs_yield.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ def capture_block_and_call_n_times(n, &block)
2121

2222
Benchmark.ips do |x|
2323
x.report("Yield #{count} times ") do
24-
yield_n_times(count) { }
24+
yield_n_times(count) {}
2525
end
2626

2727
x.report("Capture block and yield #{count} times") do
28-
capture_block_and_yield_n_times(count) { }
28+
capture_block_and_yield_n_times(count) {}
2929
end
3030

3131
x.report("Capture block and call #{count} times ") do
32-
capture_block_and_call_n_times(count) { }
32+
capture_block_and_call_n_times(count) {}
3333
end
3434
end
3535
end

spec/generators/rspec/scaffold/scaffold_generator_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
describe 'namespaced controller spec' do
5555
subject { file('spec/controllers/admin/posts_controller_spec.rb') }
5656
before { run_generator %w(admin/posts) }
57-
it { is_expected.to contain(/^RSpec.describe Admin::PostsController, #{type_metatag(:controller)}/)}
57+
it { is_expected.to contain(/^RSpec.describe Admin::PostsController, #{type_metatag(:controller)}/) }
5858
end
5959

6060
describe 'view specs' do

spec/rspec/rails/assertion_adapter_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
RSpec.describe RSpec::Rails::MinitestAssertionAdapter do
22
include RSpec::Rails::MinitestAssertionAdapter
33

4-
RSpec::Rails::Assertions.public_instance_methods.select{|m| m.to_s =~ /^(assert|flunk|refute)/}.each do |m|
4+
RSpec::Rails::Assertions.public_instance_methods.select{ |m| m.to_s =~ /^(assert|flunk|refute)/ }.each do |m|
55
if m.to_s == "assert_equal"
66
it "exposes #{m} to host examples" do
77
assert_equal 3,3

spec/rspec/rails/example/controller_example_group_spec.rb

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def my_helper
6969

7070
before do
7171
group.class_exec do
72-
controller(Class.new) { }
72+
controller(Class.new) {}
7373
end
7474

7575
allow(controller).to receive(:foos_url).and_return('http://test.host/foos')
@@ -116,13 +116,13 @@ def my_helper
116116
end
117117

118118
it "infers the anonymous controller class" do
119-
group.controller { }
119+
group.controller {}
120120
expect(group.controller_class.superclass).to eq(anonymous_klass)
121121
end
122122

123123
it "infers the anonymous controller class when no ApplicationController is present" do
124124
hide_const '::ApplicationController'
125-
group.controller { }
125+
group.controller {}
126126
expect(group.controller_class.superclass).to eq(anonymous_klass)
127127
end
128128
end
@@ -136,13 +136,13 @@ def my_helper
136136
end
137137

138138
it "sets the anonymous controller class to ApplicationController" do
139-
group.controller { }
139+
group.controller {}
140140
expect(group.controller_class.superclass).to eq(ApplicationController)
141141
end
142142

143143
it "sets the anonymous controller class to ActiveController::Base when no ApplicationController is present" do
144144
hide_const '::ApplicationController'
145-
group.controller { }
145+
group.controller {}
146146
expect(group.controller_class.superclass).to eq(ActionController::Base)
147147
end
148148
end
@@ -152,35 +152,35 @@ def my_helper
152152
let(:controller_class) { group.controller_class }
153153

154154
it "sets the name as AnonymousController if it's anonymous" do
155-
group.controller { }
155+
group.controller {}
156156
expect(controller_class.name).to eq "AnonymousController"
157157
end
158158

159159
it "sets the name according to defined controller if it is not anonymous" do
160160
stub_const "FoosController", Class.new(::ApplicationController)
161-
group.controller(FoosController) { }
161+
group.controller(FoosController) {}
162162
expect(controller_class.name).to eq "FoosController"
163163
end
164164

165165
it "sets name as AnonymousController if defined as ApplicationController" do
166-
group.controller(ApplicationController) { }
166+
group.controller(ApplicationController) {}
167167
expect(controller_class.name).to eq "AnonymousController"
168168
end
169169

170170
it "sets name as AnonymousController if the controller is abstract" do
171171
abstract_controller = Class.new(::ApplicationController)
172172
def abstract_controller.abstract?; true; end
173173

174-
group.controller(abstract_controller) { }
174+
group.controller(abstract_controller) {}
175175
expect(controller_class.name).to eq "AnonymousController"
176176
end
177177

178178
it "sets name as AnonymousController if it inherits outer group's anonymous controller" do
179179
outer_group = group_for ApplicationController
180-
outer_group.controller { }
180+
outer_group.controller {}
181181

182-
inner_group = group.describe { }
183-
inner_group.controller(outer_group.controller_class) { }
182+
inner_group = group.describe {}
183+
inner_group.controller(outer_group.controller_class) {}
184184

185185
expect(inner_group.controller_class.name).to eq "AnonymousController"
186186
end
@@ -192,7 +192,7 @@ def abstract_controller.abstract?; true; end
192192

193193
it "sets the name according to the defined controller namespace if it is not anonymous" do
194194
stub_const "A::B::FoosController", Class.new(::ApplicationController)
195-
group.controller(A::B::FoosController) { }
195+
group.controller(A::B::FoosController) {}
196196
expect(controller_class.name).to eq "A::B::FoosController"
197197
end
198198

@@ -201,7 +201,7 @@ def abstract_controller.abstract?; true; end
201201
def abstract_controller.abstract?; true; end
202202
stub_const "A::B::FoosController", abstract_controller
203203

204-
group.controller(A::B::FoosController) { }
204+
group.controller(A::B::FoosController) {}
205205
expect(controller_class.name).to eq "AnonymousController"
206206
end
207207
end

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,12 @@ def broadcast(stream, msg)
6464
end
6565

6666
it "passes when negated" do
67-
expect { }.not_to have_broadcasted_to('stream')
67+
expect {}.not_to have_broadcasted_to('stream')
6868
end
6969

7070
it "fails when message is not sent" do
7171
expect {
72-
expect { }.to have_broadcasted_to('stream')
72+
expect {}.to have_broadcasted_to('stream')
7373
}.to raise_error(/expected to broadcast exactly 1 messages to stream, but broadcast 0/)
7474
end
7575

@@ -85,7 +85,7 @@ def broadcast(stream, msg)
8585
it "reports correct number in fail error message" do
8686
broadcast('stream', 'one')
8787
expect {
88-
expect { }.to have_broadcasted_to('stream').exactly(1)
88+
expect {}.to have_broadcasted_to('stream').exactly(1)
8989
}.to raise_error(/expected to broadcast exactly 1 messages to stream, but broadcast 0/)
9090
end
9191

@@ -139,7 +139,7 @@ def broadcast(stream, msg)
139139

140140
it "generates failure message with at least hint" do
141141
expect {
142-
expect { }.to have_broadcasted_to('stream').at_least(:once)
142+
expect {}.to have_broadcasted_to('stream').at_least(:once)
143143
}.to raise_error(/expected to broadcast at least 1 messages to stream, but broadcast 0/)
144144
end
145145

spec/rspec/rails/matchers/active_job_spec.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,12 @@ def self.name; "LoggingJob"; end
9393
end
9494

9595
it "passes when negated" do
96-
expect { }.not_to have_enqueued_job
96+
expect {}.not_to have_enqueued_job
9797
end
9898

9999
it "fails when job is not enqueued" do
100100
expect {
101-
expect { }.to have_enqueued_job
101+
expect {}.to have_enqueued_job
102102
}.to raise_error(/expected to enqueue exactly 1 jobs, but enqueued 0/)
103103
end
104104

@@ -114,7 +114,7 @@ def self.name; "LoggingJob"; end
114114
it "reports correct number in fail error message" do
115115
heavy_lifting_job.perform_later
116116
expect {
117-
expect { }.to have_enqueued_job.exactly(1)
117+
expect {}.to have_enqueued_job.exactly(1)
118118
}.to raise_error(/expected to enqueue exactly 1 jobs, but enqueued 0/)
119119
end
120120

@@ -184,7 +184,7 @@ def self.name; "LoggingJob"; end
184184

185185
it "generates failure message with at least hint" do
186186
expect {
187-
expect { }.to have_enqueued_job.at_least(:once)
187+
expect {}.to have_enqueued_job.at_least(:once)
188188
}.to raise_error(/expected to enqueue at least 1 jobs, but enqueued 0/)
189189
end
190190

@@ -436,12 +436,12 @@ def self.name; "LoggingJob"; end
436436
end
437437

438438
it "passes when negated" do
439-
expect { }.not_to have_performed_job
439+
expect {}.not_to have_performed_job
440440
end
441441

442442
it "fails when job is not performed" do
443443
expect {
444-
expect { }.to have_performed_job
444+
expect {}.to have_performed_job
445445
}.to raise_error(/expected to perform exactly 1 jobs, but performed 0/)
446446
end
447447

@@ -457,7 +457,7 @@ def self.name; "LoggingJob"; end
457457
it "reports correct number in fail error message" do
458458
heavy_lifting_job.perform_later
459459
expect {
460-
expect { }.to have_performed_job.exactly(1)
460+
expect {}.to have_performed_job.exactly(1)
461461
}.to raise_error(/expected to perform exactly 1 jobs, but performed 0/)
462462
end
463463

@@ -518,7 +518,7 @@ def self.name; "LoggingJob"; end
518518

519519
it "generates failure message with at least hint" do
520520
expect {
521-
expect { }.to have_performed_job.at_least(:once)
521+
expect {}.to have_performed_job.at_least(:once)
522522
}.to raise_error(/expected to perform at least 1 jobs, but performed 0/)
523523
end
524524

spec/rspec/rails/matchers/be_a_new_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def new_record?; true; end
8282
expect {
8383
expect(record).to be_a_new(record.class).with(
8484
:foo => a_hash_including({:no_foo => "foo"}))
85-
}.to raise_error {|e|
85+
}.to raise_error { |e|
8686
expect(e.message).to eq("no implicit conversion of Hash into String").or eq("can't convert Hash into String")
8787
}
8888
end
@@ -116,7 +116,7 @@ def new_record?; true; end
116116
it "fails" do
117117
expect {
118118
expect(record).to be_a_new(record.class).with(:zoo => 'zoo', :car => 'car')
119-
}.to raise_error {|e|
119+
}.to raise_error { |e|
120120
expect(e.message).to match(/attributes \{.*\} were not set on #{Regexp.escape record.inspect}/)
121121
expect(e.message).to match(/"zoo"=>"zoo"/)
122122
expect(e.message).to match(/"car"=>"car"/)
@@ -164,7 +164,7 @@ def new_record?; false; end
164164
it "fails" do
165165
expect {
166166
expect(record).to be_a_new(String).with(:zoo => 'zoo', :car => 'car')
167-
}.to raise_error {|e|
167+
}.to raise_error { |e|
168168
expect(e.message).to match(/expected #{Regexp.escape record.inspect} to be a new String and attributes \{.*\} were not set on #{Regexp.escape record.inspect}/)
169169
expect(e.message).to match(/"zoo"=>"zoo"/)
170170
expect(e.message).to match(/"car"=>"car"/)

spec/rspec/rails/matchers/have_enqueued_mail_spec.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def email_with_args(arg1, arg2); end
6262
end
6363

6464
it "passes when negated" do
65-
expect { }.not_to have_enqueued_mail(TestMailer, :test_email)
65+
expect {}.not_to have_enqueued_mail(TestMailer, :test_email)
6666
end
6767

6868
it "passes when given 0 arguments" do
@@ -72,7 +72,7 @@ def email_with_args(arg1, arg2); end
7272
end
7373

7474
it "passes when negated with 0 arguments" do
75-
expect { }.not_to have_enqueued_email
75+
expect {}.not_to have_enqueued_email
7676
end
7777

7878
it "passes when only given mailer argument" do
@@ -82,7 +82,7 @@ def email_with_args(arg1, arg2); end
8282
end
8383

8484
it "passes when negated with only mailer arguments" do
85-
expect { }.not_to have_enqueued_email(TestMailer)
85+
expect {}.not_to have_enqueued_email(TestMailer)
8686
end
8787

8888
it "ensure that the right mailer is enqueued" do
@@ -168,19 +168,19 @@ def email_with_args(arg1, arg2); end
168168

169169
it "generates a failure message when given 0 argument" do
170170
expect {
171-
expect { }.to have_enqueued_mail.at_least(:once)
171+
expect {}.to have_enqueued_mail.at_least(:once)
172172
}.to raise_error(/expected to enqueue ActionMailer::Base at least 1 time but enqueued 0/)
173173
end
174174

175175
it "generates a failure message when given only mailer argument" do
176176
expect {
177-
expect { }.to have_enqueued_mail(TestMailer).at_least(:once)
177+
expect {}.to have_enqueued_mail(TestMailer).at_least(:once)
178178
}.to raise_error(/expected to enqueue TestMailer at least 1 time but enqueued 0/)
179179
end
180180

181181
it "generates a failure message with at least hint" do
182182
expect {
183-
expect { }.to have_enqueued_mail(TestMailer, :test_email).at_least(:once)
183+
expect {}.to have_enqueued_mail(TestMailer, :test_email).at_least(:once)
184184
}.to raise_error(/expected to enqueue TestMailer.test_email at least 1 time but enqueued 0/)
185185
end
186186

@@ -225,13 +225,13 @@ def email_with_args(arg1, arg2); end
225225

226226
it "generates a failure message" do
227227
expect {
228-
expect { }.to have_enqueued_email(TestMailer, :test_email)
228+
expect {}.to have_enqueued_email(TestMailer, :test_email)
229229
}.to raise_error(/expected to enqueue TestMailer.test_email/)
230230
end
231231

232232
it "generates a failure message with arguments" do
233233
expect {
234-
expect { }.to have_enqueued_email(TestMailer, :email_with_args).with(1, 2)
234+
expect {}.to have_enqueued_email(TestMailer, :email_with_args).with(1, 2)
235235
}.to raise_error(/expected to enqueue TestMailer.email_with_args exactly 1 time with \[1, 2\], but enqueued 0/)
236236
end
237237

spec/rspec/rails/matchers/have_http_status_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
RSpec.describe "have_http_status" do
22
def create_response(opts = {})
3-
ActionDispatch::TestResponse.new(opts.fetch(:status)).tap {|x|
3+
ActionDispatch::TestResponse.new(opts.fetch(:status)).tap { |x|
44
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
11-
response = ::ActionDispatch::Response.new(code).tap {|x|
11+
response = ::ActionDispatch::Response.new(code).tap { |x|
1212
x.request = ActionDispatch::Request.new({})
1313
}
1414

@@ -18,7 +18,7 @@ def create_response(opts = {})
1818

1919
context "given an ActionDispatch::TestResponse" do
2020
it "returns true for a response with the same code" do
21-
response = ::ActionDispatch::TestResponse.new(code).tap {|x|
21+
response = ::ActionDispatch::TestResponse.new(code).tap { |x|
2222
x.request = ActionDispatch::Request.new({})
2323
}
2424

@@ -439,7 +439,7 @@ def create_response(opts = {})
439439
begin
440440
splitter = RSpec::Support::StdErrSplitter.new(previous_stderr)
441441
$stderr = splitter
442-
response = ::ActionDispatch::Response.new(code).tap {|x|
442+
response = ::ActionDispatch::Response.new(code).tap { |x|
443443
x.request = ActionDispatch::Request.new({})
444444
}
445445
expect( matcher.matches?(response) ).to be(true)

spec/spec_helper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class Application < ::Rails::Application
1818
require 'rspec/rails'
1919
require 'ammeter/init'
2020

21-
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
21+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
2222

2323
class RSpec::Core::ExampleGroup
2424
def self.run_all(reporter=nil)

spec/support/helpers.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ def with_isolated_config
1010
RSpec.configuration = original_config
1111
end
1212

13-
RSpec.configure {|c| c.include self}
13+
RSpec.configure { |c| c.include self }
1414
end

0 commit comments

Comments
 (0)