Skip to content

Commit 8df2b81

Browse files
babrovkapirj
authored andcommitted
Enable Layout/DotPosition
1 parent a23c8d4 commit 8df2b81

File tree

9 files changed

+57
-61
lines changed

9 files changed

+57
-61
lines changed

.rubocop_todo.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
# ruby 1.8.7 required trailing dots
2-
Layout/DotPosition:
3-
EnforcedStyle: trailing
4-
51
# Over time we'd like to get this down, but this is what we're at now.
62
Metrics/CyclomaticComplexity:
73
Max: 9 # default: 6

example_app_generator/spec/verify_mailer_preview_path_spec.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ def capture_exec(*ops)
1919
ops << {err: [:child, :out]}
2020
io = IO.popen(ops)
2121
# Necessary to ignore warnings from Rails code base
22-
out = io.readlines.
23-
reject { |line| line =~ /warning: circular argument reference/ }.
24-
reject { |line| line =~ /Gem::Specification#rubyforge_project=/ }.
25-
join.
26-
chomp
22+
out = io.readlines
23+
.reject { |line| line =~ /warning: circular argument reference/ }
24+
.reject { |line| line =~ /Gem::Specification#rubyforge_project=/ }
25+
.join
26+
.chomp
2727
CaptureExec.new(out, $?.exitstatus)
2828
end
2929

lib/rspec/rails/adapters.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,9 @@ module ClassMethods
146146
# examples without exposing non-assertion methods in Test::Unit or
147147
# Minitest.
148148
def assertion_method_names
149-
::RSpec::Rails::Assertions.
150-
public_instance_methods.
151-
select do |m|
149+
::RSpec::Rails::Assertions
150+
.public_instance_methods
151+
.select do |m|
152152
m.to_s =~ /^(assert|flunk|refute)/
153153
end
154154
end

lib/rspec/rails/tasks/rspec.rake

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ RSpec::Core::RakeTask.new(spec: "spec:prepare")
1212

1313
namespace :spec do
1414
types = begin
15-
dirs = Dir['./spec/**/*_spec.rb'].
16-
map { |f| f.sub(/^\.\/(spec\/\w+)\/.*/, '\\1') }.
17-
uniq.
18-
select { |f| File.directory?(f) }
15+
dirs = Dir['./spec/**/*_spec.rb']
16+
.map { |f| f.sub(/^\.\/(spec\/\w+)\/.*/, '\\1') }
17+
.uniq
18+
.select { |f| File.directory?(f) }
1919
Hash[dirs.map { |d| [d.split('/').last, d] }]
2020
end
2121

spec/rspec/rails/example/helper_example_group_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,16 +67,16 @@ def _view
6767
context "the described is a module" do
6868
it "returns the module" do
6969
allow(group).to receive(:described_class) { FoosHelper }
70-
expect(group.determine_default_helper_class("ignore this")).
71-
to eq(FoosHelper)
70+
expect(group.determine_default_helper_class("ignore this"))
71+
.to eq(FoosHelper)
7272
end
7373
end
7474

7575
context "the described is a class" do
7676
it "returns nil" do
7777
allow(group).to receive(:described_class) { FoosHelper::InternalClass }
78-
expect(group.determine_default_helper_class("ignore this")).
79-
to be_nil
78+
expect(group.determine_default_helper_class("ignore this"))
79+
.to be_nil
8080
end
8181
end
8282
end

spec/rspec/rails/example/view_example_group_spec.rb

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ def self.helper(*); end # Stub method
111111

112112
it "uses routes helpers" do
113113
allow(::Rails.application).to receive(:routes).and_return(test_routes)
114-
expect(view_spec.image_path(double(to_param: "42"))).
115-
to eq "/images/42"
114+
expect(view_spec.image_path(double(to_param: "42")))
115+
.to eq "/images/42"
116116
end
117117
end
118118

@@ -203,19 +203,19 @@ def _default_file_to_render; end
203203

204204
context "with a common _default_file_to_render" do
205205
it "it returns the directory" do
206-
allow(view_spec).to receive(:_default_file_to_render).
207-
and_return("things/new.html.erb")
208-
expect(view_spec.__send__(:_controller_path)).
209-
to eq("things")
206+
allow(view_spec).to receive(:_default_file_to_render)
207+
.and_return("things/new.html.erb")
208+
expect(view_spec.__send__(:_controller_path))
209+
.to eq("things")
210210
end
211211
end
212212

213213
context "with a nested _default_file_to_render" do
214214
it "it returns the directory path" do
215-
allow(view_spec).to receive(:_default_file_to_render).
216-
and_return("admin/things/new.html.erb")
217-
expect(view_spec.__send__(:_controller_path)).
218-
to eq("admin/things")
215+
allow(view_spec).to receive(:_default_file_to_render)
216+
.and_return("admin/things/new.html.erb")
217+
expect(view_spec.__send__(:_controller_path))
218+
.to eq("admin/things")
219219
end
220220
end
221221
end

spec/rspec/rails/matchers/active_job_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,8 +406,8 @@ def self.name; "LoggingJob"; end
406406
future = 1.minute.from_now
407407
slightly_earlier = 58.seconds.from_now
408408
heavy_lifting_job.set(wait_until: slightly_earlier).perform_later
409-
expect(heavy_lifting_job).
410-
to have_been_enqueued.at(a_value_within(5.seconds).of(future))
409+
expect(heavy_lifting_job)
410+
.to have_been_enqueued.at(a_value_within(5.seconds).of(future))
411411
end
412412
end
413413

spec/rspec/rails/matchers/have_http_status_spec.rb

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,17 @@ def create_response(opts = { })
4848
it "has a failure message reporting it was given another type" do
4949
response = Object.new
5050

51-
expect { matcher.matches?(response) }.
52-
to change(matcher, :failure_message).
53-
to("expected a response object, but an instance of Object was received")
51+
expect { matcher.matches?(response) }
52+
.to change(matcher, :failure_message)
53+
.to("expected a response object, but an instance of Object was received")
5454
end
5555

5656
it "has a negated failure message reporting it was given another type" do
5757
response = Object.new
5858

59-
expect { matcher.matches?(response) }.
60-
to change(matcher, :failure_message_when_negated).
61-
to("expected a response object, but an instance of Object was received")
59+
expect { matcher.matches?(response) }
60+
.to change(matcher, :failure_message_when_negated)
61+
.to("expected a response object, but an instance of Object was received")
6262
end
6363
end
6464

@@ -91,26 +91,26 @@ def create_response(opts = { })
9191
any_numeric_code = 209
9292
have_numeric_code = have_http_status(any_numeric_code)
9393

94-
expect(have_numeric_code.description).
95-
to eq("respond with numeric status code 209")
94+
expect(have_numeric_code.description)
95+
.to eq("respond with numeric status code 209")
9696
end
9797

9898
it "has a failure message reporting the expected and actual status codes" do
9999
any_numeric_code = 209
100100
have_numeric_code = have_http_status(any_numeric_code)
101101
response = create_response(status: any_numeric_code + 1)
102102

103-
expect { have_numeric_code.matches? response }.
104-
to change(have_numeric_code, :failure_message).
105-
to("expected the response to have status code 209 but it was 210")
103+
expect { have_numeric_code.matches? response }
104+
.to change(have_numeric_code, :failure_message)
105+
.to("expected the response to have status code 209 but it was 210")
106106
end
107107

108108
it "has a negated failure message reporting the expected status code" do
109109
any_numeric_code = 209
110110
have_numeric_code = have_http_status(any_numeric_code)
111111

112-
expect(have_numeric_code.failure_message_when_negated).
113-
to eq("expected the response not to have status code 209 but it did")
112+
expect(have_numeric_code.failure_message_when_negated)
113+
.to eq("expected the response not to have status code 209 but it did")
114114
end
115115
end
116116

@@ -148,26 +148,26 @@ def create_response(opts = { })
148148
any_symbolic_status = created_symbolic_status
149149
have_symbolic_status = have_http_status(any_symbolic_status)
150150

151-
expect(have_symbolic_status.description).
152-
to eq("respond with status code :created (201)")
151+
expect(have_symbolic_status.description)
152+
.to eq("respond with status code :created (201)")
153153
end
154154

155155
it "has a failure message reporting the expected and actual statuses" do
156156
any_symbolic_status = created_symbolic_status
157157
have_symbolic_status = have_http_status(any_symbolic_status)
158158
response = create_response(status: created_code + 1)
159159

160-
expect { have_symbolic_status.matches? response }.
161-
to change(have_symbolic_status, :failure_message).
162-
to("expected the response to have status code :created (201) but it was :accepted (202)")
160+
expect { have_symbolic_status.matches? response }
161+
.to change(have_symbolic_status, :failure_message)
162+
.to("expected the response to have status code :created (201) but it was :accepted (202)")
163163
end
164164

165165
it "has a negated failure message reporting the expected status code" do
166166
any_symbolic_status = created_symbolic_status
167167
have_symbolic_status = have_http_status(any_symbolic_status)
168168

169-
expect(have_symbolic_status.failure_message_when_negated).
170-
to eq("expected the response not to have status code :created (201) but it did")
169+
expect(have_symbolic_status.failure_message_when_negated)
170+
.to eq("expected the response not to have status code :created (201) but it did")
171171
end
172172

173173
it "raises an ArgumentError" do
@@ -207,16 +207,16 @@ def create_response(opts = { })
207207

208208
it "has a failure message reporting the expected and actual status codes" do
209209
response = create_response(status: other_code)
210-
expect { matcher.matches? response }.
211-
to change(matcher, :failure_message).
212-
to(failure_message)
210+
expect { matcher.matches? response }
211+
.to change(matcher, :failure_message)
212+
.to(failure_message)
213213
end
214214

215215
it "has a negated failure message reporting the expected and actual status codes" do
216216
response = create_response(status: expected_code)
217-
expect { matcher.matches? response }.
218-
to change(matcher, :failure_message_when_negated).
219-
to(negated_message)
217+
expect { matcher.matches? response }
218+
.to change(matcher, :failure_message_when_negated)
219+
.to(negated_message)
220220
end
221221
end
222222

spec/sanity_check_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ def with_clean_env
2525
FileUtils.chmod 0777, script
2626

2727
with_clean_env do
28-
expect(`bundle exec #{script} 2>&1`).
29-
to match(/uninitialized constant RSpec::Support/).
30-
or match(/undefined method `require_rspec_core' for RSpec::Support:Module/)
28+
expect(`bundle exec #{script} 2>&1`)
29+
.to match(/uninitialized constant RSpec::Support/)
30+
.or match(/undefined method `require_rspec_core' for RSpec::Support:Module/)
3131

3232
expect($?.exitstatus).to eq(1)
3333
end

0 commit comments

Comments
 (0)