Skip to content

Commit 7f9a2b1

Browse files
committed
Fix Rubocop offenses
1 parent 8206053 commit 7f9a2b1

File tree

5 files changed

+53
-53
lines changed

5 files changed

+53
-53
lines changed

app/controllers/exercises_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def clone
6969
def collect_paths(files)
7070
unique_paths = files.map(&:path).compact_blank.uniq
7171
subpaths = unique_paths.map do |path|
72-
Array.new((path.split('/').length + 1)) do |n|
72+
Array.new(path.split('/').length + 1) do |n|
7373
path.split('/').shift(n).join('/')
7474
end
7575
end

spec/controllers/request_for_comments_controller_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
expect(assigns(:request_for_comments)).to eq([rfc_within_my_study_group])
8383
end
8484

85-
include_examples 'RfC visibility settings'
85+
it_behaves_like 'RfC visibility settings'
8686
end
8787

8888
describe 'GET #my_comment_requests' do
@@ -91,7 +91,7 @@
9191
expect_http_status(:ok)
9292
expect_template(:index)
9393

94-
include_examples 'RfC visibility settings'
94+
it_behaves_like 'RfC visibility settings'
9595
end
9696

9797
describe 'GET #rfcs_with_my_comments' do
@@ -100,7 +100,7 @@
100100
expect_http_status(:ok)
101101
expect_template(:index)
102102

103-
include_examples 'RfC visibility settings'
103+
it_behaves_like 'RfC visibility settings'
104104
end
105105

106106
describe 'GET #rfcs_for_exercise' do

spec/lib/runner/strategy/docker_container_pool_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
end
6464
end
6565

66-
include_examples 'Faraday error handling', :post
66+
it_behaves_like 'Faraday error handling', :post
6767
end
6868

6969
describe '#destroy_at_management' do
@@ -81,7 +81,7 @@
8181
expect(destroy_runner_stub).to have_been_requested.once
8282
end
8383

84-
include_examples 'Faraday error handling', :delete
84+
it_behaves_like 'Faraday error handling', :delete
8585
end
8686

8787
describe '#copy_files' do

spec/lib/runner/strategy/poseidon_spec.rb

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,14 @@
8282
end
8383

8484
context 'when error code is nomad overload' do
85-
include_examples(
85+
it_behaves_like(
8686
'InternalServerError (500) with error code',
8787
described_class.error_nomad_overload, Runner::Error::NotAvailable
8888
)
8989
end
9090

9191
context 'when error code is not nomad overload' do
92-
include_examples(
92+
it_behaves_like(
9393
'InternalServerError (500) with error code',
9494
described_class.error_unknown, Runner::Error::InternalServerError
9595
)
@@ -189,11 +189,11 @@
189189
end
190190

191191
[201, 204].each do |status|
192-
include_examples 'returns true when the api request was successful', status
192+
it_behaves_like 'returns true when the api request was successful', status
193193
end
194194

195195
[400, 500].each do |status|
196-
include_examples 'returns false when the api request failed', status
196+
it_behaves_like 'returns false when the api request failed', status
197197
end
198198

199199
it 'raises an exception if Faraday raises an error' do
@@ -252,8 +252,8 @@
252252
end
253253
end
254254

255-
include_examples 'BadRequest (400) error handling'
256-
include_examples 'Unauthorized (401) error handling'
255+
it_behaves_like 'BadRequest (400) error handling'
256+
it_behaves_like 'Unauthorized (401) error handling'
257257

258258
context 'when Poseidon returns NotFound (404)' do
259259
let(:response_status) { 404 }
@@ -263,9 +263,9 @@
263263
end
264264
end
265265

266-
include_examples 'InternalServerError (500) error handling'
267-
include_examples 'unknown response status error handling'
268-
include_examples 'Faraday error handling'
266+
it_behaves_like 'InternalServerError (500) error handling'
267+
it_behaves_like 'unknown response status error handling'
268+
it_behaves_like 'Faraday error handling'
269269
end
270270

271271
describe '#execute_command' do
@@ -319,12 +319,12 @@
319319
end
320320
end
321321

322-
include_examples 'BadRequest (400) error handling'
323-
include_examples 'Unauthorized (401) error handling'
324-
include_examples 'Gone (410) error handling'
325-
include_examples 'InternalServerError (500) error handling'
326-
include_examples 'unknown response status error handling'
327-
include_examples 'Faraday error handling'
322+
it_behaves_like 'BadRequest (400) error handling'
323+
it_behaves_like 'Unauthorized (401) error handling'
324+
it_behaves_like 'Gone (410) error handling'
325+
it_behaves_like 'InternalServerError (500) error handling'
326+
it_behaves_like 'unknown response status error handling'
327+
it_behaves_like 'Faraday error handling'
328328
end
329329

330330
describe '#destroy_at_management' do
@@ -352,10 +352,10 @@
352352
end
353353
end
354354

355-
include_examples 'Unauthorized (401) error handling'
356-
include_examples 'InternalServerError (500) error handling'
357-
include_examples 'unknown response status error handling'
358-
include_examples 'Faraday error handling'
355+
it_behaves_like 'Unauthorized (401) error handling'
356+
it_behaves_like 'InternalServerError (500) error handling'
357+
it_behaves_like 'unknown response status error handling'
358+
it_behaves_like 'Faraday error handling'
359359
end
360360

361361
describe '#copy_files' do
@@ -382,13 +382,13 @@
382382
end
383383
end
384384

385-
include_examples 'BadRequest (400) error handling'
386-
include_examples 'BadRequest (400) destroys local runner'
387-
include_examples 'Unauthorized (401) error handling'
388-
include_examples 'Gone (410) error handling'
389-
include_examples 'InternalServerError (500) error handling'
390-
include_examples 'unknown response status error handling'
391-
include_examples 'Faraday error handling'
385+
it_behaves_like 'BadRequest (400) error handling'
386+
it_behaves_like 'BadRequest (400) destroys local runner'
387+
it_behaves_like 'Unauthorized (401) error handling'
388+
it_behaves_like 'Gone (410) error handling'
389+
it_behaves_like 'InternalServerError (500) error handling'
390+
it_behaves_like 'unknown response status error handling'
391+
it_behaves_like 'Faraday error handling'
392392
end
393393

394394
describe '#attach_to_execution' do

spec/policies/request_for_comment_policy_spec.rb

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,12 @@
103103
let(:viewer_study_groups) { create_list(:study_group, 1, consumer: viewer_consumer) }
104104

105105
permissions(:show?) do
106-
include_examples 'grants access to everyone'
106+
it_behaves_like 'grants access to everyone'
107107
end
108108

109109
%i[mark_as_solved? set_thank_you_note?].each do |action|
110110
permissions(action) do
111-
include_examples 'grants access to admins and authors only'
111+
it_behaves_like 'grants access to admins and authors only'
112112
end
113113
end
114114
end
@@ -119,7 +119,7 @@
119119

120120
%i[mark_as_solved? set_thank_you_note? show?].each do |action|
121121
permissions(action) do
122-
include_examples 'grants access to admins and authors only'
122+
it_behaves_like 'grants access to admins and authors only'
123123
end
124124
end
125125
end
@@ -130,7 +130,7 @@
130130

131131
%i[mark_as_solved? set_thank_you_note? show?].each do |action|
132132
permissions(action) do
133-
include_examples 'grants access to admins and authors only'
133+
it_behaves_like 'grants access to admins and authors only'
134134
end
135135
end
136136
end
@@ -143,12 +143,12 @@
143143
let(:viewer_study_groups) { create_list(:study_group, 1, consumer: viewer_consumer) }
144144

145145
permissions(:show?) do
146-
include_examples 'grants access to everyone'
146+
it_behaves_like 'grants access to everyone'
147147
end
148148

149149
%i[mark_as_solved? set_thank_you_note?].each do |action|
150150
permissions(action) do
151-
include_examples 'grants access to admins and authors only'
151+
it_behaves_like 'grants access to admins and authors only'
152152
end
153153
end
154154
end
@@ -157,12 +157,12 @@
157157
let(:viewer_study_groups) { author_study_groups }
158158

159159
permissions(:show?) do
160-
include_examples 'grants access to everyone'
160+
it_behaves_like 'grants access to everyone'
161161
end
162162

163163
%i[mark_as_solved? set_thank_you_note?].each do |action|
164164
permissions(action) do
165-
include_examples 'grants access to admins and authors only'
165+
it_behaves_like 'grants access to admins and authors only'
166166
end
167167
end
168168
end
@@ -179,7 +179,7 @@
179179

180180
%i[mark_as_solved? set_thank_you_note? show?].each do |action|
181181
permissions(action) do
182-
include_examples 'grants access to admins and authors only'
182+
it_behaves_like 'grants access to admins and authors only'
183183
end
184184
end
185185
end
@@ -190,7 +190,7 @@
190190

191191
%i[mark_as_solved? set_thank_you_note? show?].each do |action|
192192
permissions(action) do
193-
include_examples 'grants access to admins and authors only'
193+
it_behaves_like 'grants access to admins and authors only'
194194
end
195195
end
196196
end
@@ -201,7 +201,7 @@
201201

202202
%i[mark_as_solved? set_thank_you_note? show?].each do |action|
203203
permissions(action) do
204-
include_examples 'grants access to admins and authors only'
204+
it_behaves_like 'grants access to admins and authors only'
205205
end
206206
end
207207
end
@@ -214,12 +214,12 @@
214214
let(:viewer_study_groups) { create_list(:study_group, 1, consumer: viewer_consumer) }
215215

216216
permissions(:show?) do
217-
include_examples 'grants access to everyone'
217+
it_behaves_like 'grants access to everyone'
218218
end
219219

220220
%i[mark_as_solved? set_thank_you_note?].each do |action|
221221
permissions(action) do
222-
include_examples 'grants access to admins and authors only'
222+
it_behaves_like 'grants access to admins and authors only'
223223
end
224224
end
225225
end
@@ -228,12 +228,12 @@
228228
let(:viewer_study_groups) { author_study_groups }
229229

230230
permissions(:show?) do
231-
include_examples 'grants access to everyone'
231+
it_behaves_like 'grants access to everyone'
232232
end
233233

234234
%i[mark_as_solved? set_thank_you_note?].each do |action|
235235
permissions(action) do
236-
include_examples 'grants access to admins and authors only'
236+
it_behaves_like 'grants access to admins and authors only'
237237
end
238238
end
239239
end
@@ -250,7 +250,7 @@
250250

251251
%i[mark_as_solved? set_thank_you_note? show?].each do |action|
252252
permissions(action) do
253-
include_examples 'grants access to admins and authors only'
253+
it_behaves_like 'grants access to admins and authors only'
254254
end
255255
end
256256
end
@@ -261,7 +261,7 @@
261261

262262
%i[mark_as_solved? set_thank_you_note? show?].each do |action|
263263
permissions(action) do
264-
include_examples 'grants access to admins and authors only'
264+
it_behaves_like 'grants access to admins and authors only'
265265
end
266266
end
267267
end
@@ -272,7 +272,7 @@
272272

273273
%i[mark_as_solved? set_thank_you_note? show?].each do |action|
274274
permissions(action) do
275-
include_examples 'grants access to admins and authors only'
275+
it_behaves_like 'grants access to admins and authors only'
276276
end
277277
end
278278
end
@@ -286,7 +286,7 @@
286286

287287
%i[mark_as_solved? set_thank_you_note? show?].each do |action|
288288
permissions(action) do
289-
include_examples 'grants access to admins and authors only'
289+
it_behaves_like 'grants access to admins and authors only'
290290
end
291291
end
292292
end
@@ -295,12 +295,12 @@
295295
let(:viewer_study_groups) { author_study_groups }
296296

297297
permissions(:show?) do
298-
include_examples 'grants access to everyone'
298+
it_behaves_like 'grants access to everyone'
299299
end
300300

301301
%i[mark_as_solved? set_thank_you_note?].each do |action|
302302
permissions(action) do
303-
include_examples 'grants access to admins and authors only'
303+
it_behaves_like 'grants access to admins and authors only'
304304
end
305305
end
306306
end

0 commit comments

Comments
 (0)