command_line_reporter 3.3.4 → 4.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -11,9 +11,9 @@ describe CommandLineReporter do
11
11
 
12
12
  let :controls do
13
13
  {
14
- :clear => "\e[0m",
15
- :bold => "\e[1m",
16
- :red => "\e[31m",
14
+ clear: "\e[0m",
15
+ bold: "\e[1m",
16
+ red: "\e[31m"
17
17
  }
18
18
  end
19
19
 
@@ -23,9 +23,9 @@ describe CommandLineReporter do
23
23
 
24
24
  describe '#formatter=' do
25
25
  it 'only allows allowed formatters' do
26
- expect {
26
+ expect do
27
27
  subject.formatter = 'asfd'
28
- }.to raise_error ArgumentError
28
+ end.to raise_error ArgumentError
29
29
  end
30
30
 
31
31
  it 'specifies the progress formatter' do
@@ -41,105 +41,105 @@ describe CommandLineReporter do
41
41
 
42
42
  describe '#report' do
43
43
  it 'uses the nested formatter as default' do
44
- capture_stdout {
45
- subject.report { }
46
- }
44
+ capture_stdout do
45
+ subject.report {}
46
+ end
47
47
 
48
48
  expect(subject.formatter.class).to eq(CommandLineReporter::NestedFormatter)
49
49
  end
50
50
 
51
51
  it 'uses the progress formatter' do
52
- capture_stdout {
52
+ capture_stdout do
53
53
  subject.formatter = 'progress'
54
- subject.report { }
55
- }
54
+ subject.report {}
55
+ end
56
56
 
57
57
  expect(subject.formatter.class).to eq(CommandLineReporter::ProgressFormatter)
58
58
  end
59
59
 
60
60
  it 'does not mask other application errors when a formatter is not set' do
61
- capture_stdout {
62
- subject.report {
63
- expect {self.some_method_that_does_not_exist}.to raise_error(NoMethodError)
64
- }
65
- }
61
+ capture_stdout do
62
+ subject.report do
63
+ # rubocop:disable Style/RedundantSelf
64
+ expect { self.some_method_that_does_not_exist }.to raise_error(NoMethodError)
65
+ end
66
+ end
66
67
  end
67
68
  end
68
69
 
69
70
  describe '#header' do
70
71
  context 'argument validation' do
71
-
72
72
  it 'does not accept an invalid option' do
73
- expect {
74
- subject.header(:asdf => 'tests')
75
- }.to raise_error ArgumentError
73
+ expect do
74
+ subject.header(asdf: 'tests')
75
+ end.to raise_error ArgumentError
76
76
  end
77
77
 
78
78
  it 'accepts a title' do
79
- expect {
79
+ expect do
80
80
  allow(subject).to receive(:puts)
81
- subject.header(:title => 'test')
82
- }.to_not raise_error
81
+ subject.header(title: 'test')
82
+ end.to_not raise_error Exception
83
83
  end
84
84
 
85
85
  it 'does not allow a title > width' do
86
- expect {
87
- subject.header(:title => 'xxxxxxxxxxx', :width => 5)
88
- }.to raise_error ArgumentError
86
+ expect do
87
+ subject.header(title: 'xxxxxxxxxxx', width: 5)
88
+ end.to raise_error ArgumentError
89
89
  end
90
90
 
91
91
  it 'accepts width' do
92
- expect {
92
+ expect do
93
93
  allow(subject).to receive(:puts)
94
- subject.header(:width => 100)
95
- }.to_not raise_error
94
+ subject.header(width: 100)
95
+ end.to_not raise_error Exception
96
96
  end
97
97
 
98
98
  it 'ensure width is a number' do
99
- expect {
100
- subject.header(:width => '100')
101
- }.to raise_error ArgumentError
99
+ expect do
100
+ subject.header(width: 'adf')
101
+ end.to raise_error ArgumentError
102
102
  end
103
103
 
104
104
  it 'accepts align' do
105
- expect {
105
+ expect do
106
106
  allow(subject).to receive(:puts)
107
- subject.header(:align => 'center')
108
- }.to_not raise_error
107
+ subject.header(align: 'center')
108
+ end.to_not raise_error Exception
109
109
  end
110
110
 
111
111
  it 'ensure align is a valid value' do
112
- expect {
113
- subject.header(:align => :asdf)
114
- }.to raise_error ArgumentError
112
+ expect do
113
+ subject.header(align: :asdf)
114
+ end.to raise_error ArgumentError
115
115
  end
116
116
 
117
117
  it 'accepts spacing' do
118
- expect {
118
+ expect do
119
119
  allow(subject).to receive(:puts)
120
- subject.header(:spacing => 2)
121
- }.to_not raise_error
120
+ subject.header(spacing: 2)
121
+ end.to_not raise_error Exception
122
122
  end
123
123
 
124
124
  it 'accepts timestamp' do
125
- expect {
125
+ expect do
126
126
  allow(subject).to receive(:puts)
127
- subject.header(:timestamp => true)
128
- }.to_not raise_error
127
+ subject.header(timestamp: true)
128
+ end.to_not raise_error Exception
129
129
  end
130
130
 
131
131
  it 'accepts color' do
132
- expect {
132
+ expect do
133
133
  allow(subject).to receive(:puts)
134
- subject.header(:color => 'red')
135
- }.to_not raise_error
134
+ subject.header(color: 'red')
135
+ end.to_not raise_error Exception
136
136
  end
137
137
 
138
138
  it 'accepts bold' do
139
- expect {
139
+ expect do
140
140
  allow(subject).to receive(:puts)
141
- subject.header(:bold => true)
142
- }.to_not raise_error
141
+ subject.header(bold: true)
142
+ end.to_not raise_error Exception
143
143
  end
144
144
  end
145
145
 
@@ -151,37 +151,37 @@ describe CommandLineReporter do
151
151
  it 'left aligns title by default' do
152
152
  expect(subject).to receive(:puts).with(@title)
153
153
  expect(subject).to receive(:puts).with("\n")
154
- subject.header(:title => @title) { }
154
+ subject.header(title: @title) {}
155
155
  end
156
156
 
157
157
  it 'left aligns title' do
158
158
  expect(subject).to receive(:puts).with(@title)
159
159
  expect(subject).to receive(:puts).with("\n")
160
- subject.header(:title => @title, :align => 'left') { }
160
+ subject.header(title: @title, align: 'left') {}
161
161
  end
162
162
 
163
163
  it 'right aligns title using default width' do
164
164
  expect(subject).to receive(:puts).with(' ' * 90 + @title)
165
165
  expect(subject).to receive(:puts).with("\n")
166
- subject.header(:title => @title, :align => 'right')
166
+ subject.header(title: @title, align: 'right')
167
167
  end
168
168
 
169
169
  it 'right aligns title using specified width' do
170
170
  expect(subject).to receive(:puts).with(' ' * 40 + @title)
171
171
  expect(subject).to receive(:puts).with("\n")
172
- subject.header(:title => @title, :align => 'right', :width => 50)
172
+ subject.header(title: @title, align: 'right', width: 50)
173
173
  end
174
174
 
175
175
  it 'center aligns title using default width' do
176
176
  expect(subject).to receive(:puts).with(' ' * 45 + @title)
177
177
  expect(subject).to receive(:puts).with("\n")
178
- subject.header(:title => @title, :align => 'center')
178
+ subject.header(title: @title, align: 'center')
179
179
  end
180
180
 
181
181
  it 'center aligns title using specified width' do
182
182
  expect(subject).to receive(:puts).with(' ' * 35 + @title)
183
183
  expect(subject).to receive(:puts).with("\n")
184
- subject.header(:title => @title, :align => 'center', :width => 80)
184
+ subject.header(title: @title, align: 'center', width: 80)
185
185
  end
186
186
  end
187
187
 
@@ -189,13 +189,13 @@ describe CommandLineReporter do
189
189
  it 'defaults to a single line of spacing between report' do
190
190
  expect(subject).to receive(:puts).with('title')
191
191
  expect(subject).to receive(:puts).with("\n")
192
- subject.header(:title => 'title')
192
+ subject.header(title: 'title')
193
193
  end
194
194
 
195
195
  it 'uses the defined spacing between report' do
196
196
  expect(subject).to receive(:puts).with('title')
197
197
  expect(subject).to receive(:puts).with("\n" * 3)
198
- subject.header(:title => 'title', :spacing => 3)
198
+ subject.header(title: 'title', spacing: 3)
199
199
  end
200
200
  end
201
201
 
@@ -204,21 +204,21 @@ describe CommandLineReporter do
204
204
  expect(subject).to receive(:puts).with('title')
205
205
  expect(subject).to receive(:puts).with(/^#{timestamp_regex}/)
206
206
  expect(subject).to receive(:puts).with("\n")
207
- subject.header(:title => 'title', :timestamp => true)
207
+ subject.header(title: 'title', timestamp: true)
208
208
  end
209
209
 
210
210
  it 'added with right alignment' do
211
211
  expect(subject).to receive(:puts).with(/^ *title$/)
212
212
  expect(subject).to receive(:puts).with(/^ *#{timestamp_regex}$/)
213
213
  expect(subject).to receive(:puts).with("\n")
214
- subject.header(:title => 'title', :align => 'right', :timestamp => true, :width => 80)
214
+ subject.header(title: 'title', align: 'right', timestamp: true, width: 80)
215
215
  end
216
216
 
217
217
  it 'added with center alignment' do
218
218
  expect(subject).to receive(:puts).with(/^ *title *$/)
219
219
  expect(subject).to receive(:puts).with(/^ *#{timestamp_regex} *$/)
220
220
  expect(subject).to receive(:puts).with("\n")
221
- subject.header(:title => 'title', :align => 'center', :timestamp => true, :width => 80)
221
+ subject.header(title: 'title', align: 'center', timestamp: true, width: 80)
222
222
  end
223
223
  end
224
224
 
@@ -227,14 +227,14 @@ describe CommandLineReporter do
227
227
  expect(subject).to receive(:puts)
228
228
  expect(subject).to receive(:puts).with(linechar * 100)
229
229
  expect(subject).to receive(:puts)
230
- subject.header(:rule => true)
230
+ subject.header(rule: true)
231
231
  end
232
232
 
233
233
  it 'uses = as the rule character' do
234
234
  expect(subject).to receive(:puts)
235
235
  expect(subject).to receive(:puts).with('=' * 100)
236
236
  expect(subject).to receive(:puts)
237
- subject.header(:rule => '=')
237
+ subject.header(rule: '=')
238
238
  end
239
239
  end
240
240
 
@@ -242,14 +242,14 @@ describe CommandLineReporter do
242
242
  it 'single red line' do
243
243
  expect(subject).to receive(:puts).with(controls[:red] + 'Report' + controls[:clear])
244
244
  expect(subject).to receive(:puts)
245
- subject.header(:color => 'red')
245
+ subject.header(color: 'red')
246
246
  end
247
247
 
248
248
  it 'multimple red lines' do
249
249
  expect(subject).to receive(:puts).with(controls[:red] + 'Report' + controls[:clear])
250
250
  expect(subject).to receive(:puts).with(controls[:red] + linechar * 100 + controls[:clear])
251
251
  expect(subject).to receive(:puts)
252
- subject.header(:color => 'red', :rule => true)
252
+ subject.header(color: 'red', rule: true)
253
253
  end
254
254
  end
255
255
 
@@ -257,14 +257,14 @@ describe CommandLineReporter do
257
257
  it 'single line' do
258
258
  expect(subject).to receive(:puts).with(controls[:bold] + 'Report' + controls[:clear])
259
259
  expect(subject).to receive(:puts)
260
- subject.header(:bold => true)
260
+ subject.header(bold: true)
261
261
  end
262
262
 
263
263
  it 'multimple lines' do
264
264
  expect(subject).to receive(:puts).with(controls[:bold] + 'Report' + controls[:clear])
265
265
  expect(subject).to receive(:puts).with(controls[:bold] + linechar * 100 + controls[:clear])
266
266
  expect(subject).to receive(:puts)
267
- subject.header(:bold => true, :rule => true)
267
+ subject.header(bold: true, rule: true)
268
268
  end
269
269
  end
270
270
  end
@@ -272,23 +272,23 @@ describe CommandLineReporter do
272
272
  describe '#horizontal_rule' do
273
273
  context 'argument validation' do
274
274
  it 'does not allow invalid options' do
275
- expect {
276
- subject.horizontal_rule(:asdf => true)
277
- }.to raise_error ArgumentError
275
+ expect do
276
+ subject.horizontal_rule(asdf: true)
277
+ end.to raise_error ArgumentError
278
278
  end
279
279
 
280
280
  it 'accepts char' do
281
- expect {
281
+ expect do
282
282
  expect(subject).to receive(:puts)
283
- subject.horizontal_rule(:char => '*')
284
- }.to_not raise_error
283
+ subject.horizontal_rule(char: '*')
284
+ end.to_not raise_error Exception
285
285
  end
286
286
 
287
287
  it 'accepts width' do
288
- expect {
288
+ expect do
289
289
  expect(subject).to receive(:puts)
290
- subject.horizontal_rule(:width => 10)
291
- }.to_not raise_error
290
+ subject.horizontal_rule(width: 10)
291
+ end.to_not raise_error Exception
292
292
  end
293
293
  end
294
294
 
@@ -300,35 +300,37 @@ describe CommandLineReporter do
300
300
 
301
301
  it 'writes a 100 yard asterisk' do
302
302
  expect(subject).to receive(:puts).with('*' * 100)
303
- subject.horizontal_rule(:char => '*')
303
+ subject.horizontal_rule(char: '*')
304
304
  end
305
305
 
306
306
  it 'writes a 50 yard equals' do
307
307
  expect(subject).to receive(:puts).with('=' * 50)
308
- subject.horizontal_rule(:char => '=', :width => 50)
308
+ subject.horizontal_rule(char: '=', width: 50)
309
309
  end
310
310
  end
311
311
 
312
312
  it 'outputs color' do
313
313
  expect(subject).to receive(:puts).with(controls[:red] + linechar * 100 + controls[:clear])
314
- subject.horizontal_rule(:color => 'red')
314
+ subject.horizontal_rule(color: 'red')
315
315
  end
316
316
 
317
317
  it 'outputs bold' do
318
318
  expect(subject).to receive(:puts).with(controls[:bold] + linechar * 100 + controls[:clear])
319
- subject.horizontal_rule(:bold => true)
319
+ subject.horizontal_rule(bold: true)
320
320
  end
321
321
  end
322
322
 
323
323
  describe '#vertical_spacing' do
324
324
  it 'accepts a fixnum as a valid argument' do
325
- expect {
325
+ expect do
326
326
  subject.vertical_spacing('asdf')
327
- }.to raise_error ArgumentError
327
+ end.to raise_error ArgumentError
328
328
  end
329
329
 
330
330
  it 'prints carriage returns for the number of lines' do
331
- expect(subject).to receive(:puts).with("\n" * 3)
331
+ expect(subject).to receive(:print).with("\0").and_return(nil)
332
+ expect(subject).to receive(:puts).with("\n" * 3).and_return("\n\n\n")
333
+ subject.vertical_spacing(0)
332
334
  subject.vertical_spacing(3)
333
335
  end
334
336
  end
@@ -336,48 +338,48 @@ describe CommandLineReporter do
336
338
  describe '#datetime' do
337
339
  context 'argument validation' do
338
340
  it 'does not allow invalid options' do
339
- expect {
340
- subject.datetime(:asdf => true)
341
- }.to raise_error ArgumentError
341
+ expect do
342
+ subject.datetime(asdf: true)
343
+ end.to raise_error ArgumentError
342
344
  end
343
345
 
344
346
  it 'accepts align' do
345
- expect {
347
+ expect do
346
348
  expect(subject).to receive(:puts)
347
- subject.datetime(:align => 'left')
348
- }.to_not raise_error
349
+ subject.datetime(align: 'left')
350
+ end.to_not raise_error Exception
349
351
  end
350
352
 
351
353
  it 'accepts width' do
352
- expect {
354
+ expect do
353
355
  expect(subject).to receive(:puts)
354
- subject.datetime(:width => 70)
355
- }.to_not raise_error
356
+ subject.datetime(width: 70)
357
+ end.to_not raise_error Exception
356
358
  end
357
359
 
358
360
  it 'accepts format' do
359
- expect {
361
+ expect do
360
362
  expect(subject).to receive(:puts)
361
- subject.datetime(:format => '%m/%d/%Y')
362
- }.to_not raise_error
363
+ subject.datetime(format: '%m/%d/%Y')
364
+ end.to_not raise_error Exception
363
365
  end
364
366
 
365
367
  it 'does not allow invalid width' do
366
- expect {
367
- subject.datetime(:align => 'right', :width => 'asdf')
368
- }.to raise_error
368
+ expect do
369
+ subject.datetime(align: 'right', width: 'asdf')
370
+ end.to raise_error Exception
369
371
  end
370
372
 
371
373
  it 'does not allow invalid align' do
372
- expect {
373
- subject.datetime(:align => 1234)
374
- }.to raise_error
374
+ expect do
375
+ subject.datetime(align: 1234)
376
+ end.to raise_error Exception
375
377
  end
376
378
 
377
379
  it 'does not allow a timestamp format larger than the width' do
378
- expect {
379
- subject.datetime(:width => 8)
380
- }.to raise_error
380
+ expect do
381
+ subject.datetime(width: 8)
382
+ end.to raise_error Exception
381
383
  end
382
384
  end
383
385
 
@@ -389,118 +391,117 @@ describe CommandLineReporter do
389
391
 
390
392
  it 'a default format - right aligned' do
391
393
  expect(subject).to receive(:puts).with(/^ *#{timestamp_regex}$/)
392
- subject.datetime(:align => 'right')
394
+ subject.datetime(align: 'right')
393
395
  end
394
396
 
395
397
  it 'a default format - center aligned' do
396
398
  expect(subject).to receive(:puts).with(/^ *#{timestamp_regex} *$/)
397
- subject.datetime(:align => 'center')
399
+ subject.datetime(align: 'center')
398
400
  end
399
401
 
400
402
  it 'a modified format' do
401
- expect(subject).to receive(:puts).with(/^\d{2}\/\d{2}\/\d{2} *$/)
402
- subject.datetime(:format => '%y/%m/%d')
403
+ expect(subject).to receive(:puts).with(%r/^\d{2}\/\d{2}\/\d{2} *$/)
404
+ subject.datetime(format: '%y/%m/%d')
403
405
  end
404
406
  end
405
407
 
406
408
  it 'outputs color' do
407
409
  expect(subject).to receive(:puts).with(/^\e\[31m#{timestamp_regex}\e\[0m/)
408
- subject.datetime(:color => 'red')
410
+ subject.datetime(color: 'red')
409
411
  end
410
412
 
411
413
  it 'outputs bold' do
412
414
  expect(subject).to receive(:puts).with(/^\e\[1m#{timestamp_regex}\e\[0m/)
413
- subject.datetime(:bold => true)
415
+ subject.datetime(bold: true)
414
416
  end
415
417
  end
416
418
 
417
419
  describe '#aligned' do
418
420
  context 'argument validation' do
419
421
  it 'accepts align' do
420
- expect {
422
+ expect do
421
423
  allow(subject).to receive(:puts)
422
- subject.aligned('test', :align => 'left')
423
- }.to_not raise_error
424
+ subject.aligned('test', align: 'left')
425
+ end.to_not raise_error Exception
424
426
  end
425
427
 
426
428
  it 'does not allow invalid align values' do
427
- expect {
428
- subject.aligned('test', :align => 1234)
429
- }.to raise_error ArgumentError
429
+ expect do
430
+ subject.aligned('test', align: 1234)
431
+ end.to raise_error NoMethodError
430
432
  end
431
433
 
432
434
  it 'accepts width' do
433
- expect {
435
+ expect do
434
436
  allow(subject).to receive(:puts)
435
- subject.aligned('test', :width => 40)
436
- }.to_not raise_error
437
+ subject.aligned('test', width: 40)
438
+ end.to_not raise_error Exception
437
439
  end
438
440
 
439
441
  it 'does not allow invalid width values' do
440
- expect {
441
- subject.aligned('test', :align => 'right', :width => 'asdf')
442
- }.to raise_error
442
+ expect do
443
+ subject.aligned('test', align: 'right', width: 'asdf')
444
+ end.to raise_error Exception
443
445
  end
444
446
  end
445
447
 
446
448
  it 'outputs color' do
447
449
  expect(subject).to receive(:puts).with(controls[:red] + 'x' * 10 + controls[:clear])
448
- subject.aligned('x' * 10, :color => 'red')
450
+ subject.aligned('x' * 10, color: 'red')
449
451
  end
450
452
 
451
453
  it 'outputs bold' do
452
454
  expect(subject).to receive(:puts).with(controls[:bold] + 'x' * 10 + controls[:clear])
453
- subject.aligned('x' * 10, :bold => true)
455
+ subject.aligned('x' * 10, bold: true)
454
456
  end
455
-
456
457
  end
457
458
 
458
459
  describe '#footer' do
459
460
  context 'argument validation' do
460
461
  it 'accepts title' do
461
- expect {
462
+ expect do
462
463
  allow(subject).to receive(:puts)
463
- subject.footer(:title => 'test')
464
- }.to_not raise_error
464
+ subject.footer(title: 'test')
465
+ end.to_not raise_error Exception
465
466
  end
466
467
 
467
468
  it 'accepts align' do
468
- expect {
469
+ expect do
469
470
  allow(subject).to receive(:puts)
470
- subject.footer(:align => 'right')
471
- }.to_not raise_error
471
+ subject.footer(align: 'right')
472
+ end.to_not raise_error Exception
472
473
  end
473
474
 
474
475
  it 'does not accept invalid align' do
475
- expect {
476
- subject.header(:align => 1234)
477
- }.to raise_error ArgumentError
476
+ expect do
477
+ subject.header(align: 1234)
478
+ end.to raise_error NoMethodError
478
479
  end
479
480
 
480
481
  it 'accepts width' do
481
- expect {
482
+ expect do
482
483
  allow(subject).to receive(:puts)
483
- subject.footer(:width => 50)
484
- }.to_not raise_error
484
+ subject.footer(width: 50)
485
+ end.to_not raise_error Exception
485
486
  end
486
487
 
487
488
  it 'does not accept invalid width' do
488
- expect {
489
- subject.footer(:width => 'asdf')
490
- }.to raise_error ArgumentError
489
+ expect do
490
+ subject.footer(width: 'asdf')
491
+ end.to raise_error ArgumentError
491
492
  end
492
493
 
493
494
  it 'does not allow title > width' do
494
- expect {
495
- subject.footer(:title => 'testtesttest', :width => 6)
496
- }.to raise_error ArgumentError
495
+ expect do
496
+ subject.footer(title: 'testtesttest', width: 6)
497
+ end.to raise_error ArgumentError
497
498
  end
498
499
 
499
500
  it 'accepts spacing' do
500
- expect {
501
+ expect do
501
502
  allow(subject).to receive(:puts)
502
- subject.footer(:spacing => 3)
503
- }.to_not raise_error
503
+ subject.footer(spacing: 3)
504
+ end.to_not raise_error Exception
504
505
  end
505
506
  end
506
507
 
@@ -512,37 +513,37 @@ describe CommandLineReporter do
512
513
  it 'left aligns the title by default' do
513
514
  expect(subject).to receive(:puts).with("\n")
514
515
  expect(subject).to receive(:puts).with(@title)
515
- subject.footer(:title => @title)
516
+ subject.footer(title: @title)
516
517
  end
517
518
 
518
519
  it 'left aligns the title' do
519
520
  expect(subject).to receive(:puts).with("\n")
520
521
  expect(subject).to receive(:puts).with(@title)
521
- subject.footer(:title => @title, :align => 'left')
522
+ subject.footer(title: @title, align: 'left')
522
523
  end
523
524
 
524
525
  it 'right aligns the title' do
525
526
  expect(subject).to receive(:puts).with("\n")
526
527
  expect(subject).to receive(:puts).with(' ' * 90 + @title)
527
- subject.footer(:title => @title, :align => 'right')
528
+ subject.footer(title: @title, align: 'right')
528
529
  end
529
530
 
530
531
  it 'right aligns the title using width' do
531
532
  expect(subject).to receive(:puts).with("\n")
532
533
  expect(subject).to receive(:puts).with(' ' * 40 + @title)
533
- subject.footer(:title => @title, :align => 'right', :width => 50)
534
+ subject.footer(title: @title, align: 'right', width: 50)
534
535
  end
535
536
 
536
537
  it 'center aligns the title' do
537
538
  expect(subject).to receive(:puts).with("\n")
538
539
  expect(subject).to receive(:puts).with(' ' * 45 + @title)
539
- subject.footer(:title => @title, :align => 'center')
540
+ subject.footer(title: @title, align: 'center')
540
541
  end
541
542
 
542
543
  it 'center aligns the title using width' do
543
544
  expect(subject).to receive(:puts).with("\n")
544
545
  expect(subject).to receive(:puts).with(' ' * 35 + @title)
545
- subject.footer(:title => @title, :align => 'center', :width => 80)
546
+ subject.footer(title: @title, align: 'center', width: 80)
546
547
  end
547
548
  end
548
549
 
@@ -550,13 +551,13 @@ describe CommandLineReporter do
550
551
  it 'defaults to a single line of spacing between report' do
551
552
  expect(subject).to receive(:puts).with("\n")
552
553
  expect(subject).to receive(:puts).with('title')
553
- subject.footer(:title => 'title')
554
+ subject.footer(title: 'title')
554
555
  end
555
556
 
556
557
  it 'uses the defined spacing between report' do
557
558
  expect(subject).to receive(:puts).with("\n" * 3)
558
559
  expect(subject).to receive(:puts).with('title')
559
- subject.footer(:title => 'title', :spacing => 3)
560
+ subject.footer(title: 'title', spacing: 3)
560
561
  end
561
562
  end
562
563
 
@@ -565,21 +566,21 @@ describe CommandLineReporter do
565
566
  expect(subject).to receive(:puts).with("\n")
566
567
  expect(subject).to receive(:puts).with('title')
567
568
  expect(subject).to receive(:puts).with(/^#{timestamp_regex}/)
568
- subject.footer(:title => 'title', :timestamp => true)
569
+ subject.footer(title: 'title', timestamp: true)
569
570
  end
570
571
 
571
572
  it 'added with right alignment' do
572
573
  expect(subject).to receive(:puts).with("\n")
573
574
  expect(subject).to receive(:puts).with(/^ *title$/)
574
575
  expect(subject).to receive(:puts).with(/^ *#{timestamp_regex}$/)
575
- subject.footer(:title => 'title', :align => 'right', :timestamp => true, :width => 80)
576
+ subject.footer(title: 'title', align: 'right', timestamp: true, width: 80)
576
577
  end
577
578
 
578
579
  it 'added with center alignment' do
579
580
  expect(subject).to receive(:puts).with("\n")
580
581
  expect(subject).to receive(:puts).with(/^ *title *$/)
581
582
  expect(subject).to receive(:puts).with(/^ *#{timestamp_regex} *$/)
582
- subject.footer(:title => 'title', :align => 'center', :timestamp => true, :width => 80)
583
+ subject.footer(title: 'title', align: 'center', timestamp: true, width: 80)
583
584
  end
584
585
  end
585
586
 
@@ -588,14 +589,14 @@ describe CommandLineReporter do
588
589
  expect(subject).to receive(:puts)
589
590
  expect(subject).to receive(:puts).with(linechar * 100)
590
591
  expect(subject).to receive(:puts)
591
- subject.footer(:rule => true)
592
+ subject.footer(rule: true)
592
593
  end
593
594
 
594
595
  it 'uses = as the rule character' do
595
596
  expect(subject).to receive(:puts)
596
597
  expect(subject).to receive(:puts).with('=' * 100)
597
598
  expect(subject).to receive(:puts)
598
- subject.footer(:rule => '=')
599
+ subject.footer(rule: '=')
599
600
  end
600
601
  end
601
602
 
@@ -603,14 +604,14 @@ describe CommandLineReporter do
603
604
  expect(subject).to receive(:puts).with("\n")
604
605
  expect(subject).to receive(:puts).with(controls[:red] + 'title' + controls[:clear])
605
606
  expect(subject).to receive(:puts).with(/^\e\[31m#{timestamp_regex}\e\[0m/)
606
- subject.footer(:title => 'title', :timestamp => true, :color => 'red')
607
+ subject.footer(title: 'title', timestamp: true, color: 'red')
607
608
  end
608
609
 
609
610
  it 'outputs bold' do
610
611
  expect(subject).to receive(:puts).with("\n")
611
612
  expect(subject).to receive(:puts).with(controls[:bold] + 'title' + controls[:clear])
612
613
  expect(subject).to receive(:puts).with(/^\e\[1m#{timestamp_regex}\e\[0m/)
613
- subject.footer(:title => 'title', :timestamp => true, :bold => true)
614
+ subject.footer(title: 'title', timestamp: true, bold: true)
614
615
  end
615
616
  end
616
617
 
@@ -618,26 +619,26 @@ describe CommandLineReporter do
618
619
  it 'instantiates the table class' do
619
620
  allow(subject).to receive(:puts)
620
621
  expect(subject).to receive(:table).once
621
- subject.table { }
622
+ subject.table {}
622
623
  end
623
624
 
624
625
  it 'requires a row to be defined' do
625
- expect {
626
+ expect do
626
627
  subject.table
627
- }.to raise_error LocalJumpError
628
+ end.to raise_error LocalJumpError
628
629
  end
629
630
 
630
631
  it 'accepts valid options' do
631
- expect {
632
- subject.table(:border => true) { }
633
- }.to_not raise_error
632
+ expect do
633
+ subject.table(border: true) {}
634
+ end.to_not raise_error Exception
634
635
  end
635
636
 
636
637
  it 'rejects invalid options' do
637
- expect {
638
+ expect do
638
639
  allow(subject).to receive(:puts)
639
- subject.table(:asdf => '100') { }
640
- }.to raise_error ArgumentError
640
+ subject.table(asdf: '100') {}
641
+ end.to raise_error ArgumentError
641
642
  end
642
643
  end
643
644
 
@@ -673,21 +674,20 @@ describe CommandLineReporter do
673
674
 
674
675
  subject.table do
675
676
  subject.row do
676
- subject.column('asdf', :width => 30)
677
+ subject.column('asdf', width: 30)
677
678
  end
678
679
  end
679
680
  end
680
681
 
681
682
  it 'rejects invalid options' do
682
683
  allow(subject).to receive(:puts)
683
- expect {
684
+ expect do
684
685
  subject.table do
685
686
  subject.row do
686
- subject.column('asdf', :asdf => 30)
687
+ subject.column('asdf', asdf: 30)
687
688
  end
688
689
  end
689
- }.to raise_error ArgumentError
690
+ end.to raise_error ArgumentError
690
691
  end
691
692
  end
692
-
693
693
  end