command_line_reporter 3.3.6 → 4.0.0

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,31 +300,31 @@ 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
@@ -338,48 +338,48 @@ describe CommandLineReporter do
338
338
  describe '#datetime' do
339
339
  context 'argument validation' do
340
340
  it 'does not allow invalid options' do
341
- expect {
342
- subject.datetime(:asdf => true)
343
- }.to raise_error ArgumentError
341
+ expect do
342
+ subject.datetime(asdf: true)
343
+ end.to raise_error ArgumentError
344
344
  end
345
345
 
346
346
  it 'accepts align' do
347
- expect {
347
+ expect do
348
348
  expect(subject).to receive(:puts)
349
- subject.datetime(:align => 'left')
350
- }.to_not raise_error
349
+ subject.datetime(align: 'left')
350
+ end.to_not raise_error Exception
351
351
  end
352
352
 
353
353
  it 'accepts width' do
354
- expect {
354
+ expect do
355
355
  expect(subject).to receive(:puts)
356
- subject.datetime(:width => 70)
357
- }.to_not raise_error
356
+ subject.datetime(width: 70)
357
+ end.to_not raise_error Exception
358
358
  end
359
359
 
360
360
  it 'accepts format' do
361
- expect {
361
+ expect do
362
362
  expect(subject).to receive(:puts)
363
- subject.datetime(:format => '%m/%d/%Y')
364
- }.to_not raise_error
363
+ subject.datetime(format: '%m/%d/%Y')
364
+ end.to_not raise_error Exception
365
365
  end
366
366
 
367
367
  it 'does not allow invalid width' do
368
- expect {
369
- subject.datetime(:align => 'right', :width => 'asdf')
370
- }.to raise_error
368
+ expect do
369
+ subject.datetime(align: 'right', width: 'asdf')
370
+ end.to raise_error Exception
371
371
  end
372
372
 
373
373
  it 'does not allow invalid align' do
374
- expect {
375
- subject.datetime(:align => 1234)
376
- }.to raise_error
374
+ expect do
375
+ subject.datetime(align: 1234)
376
+ end.to raise_error Exception
377
377
  end
378
378
 
379
379
  it 'does not allow a timestamp format larger than the width' do
380
- expect {
381
- subject.datetime(:width => 8)
382
- }.to raise_error
380
+ expect do
381
+ subject.datetime(width: 8)
382
+ end.to raise_error Exception
383
383
  end
384
384
  end
385
385
 
@@ -391,118 +391,117 @@ describe CommandLineReporter do
391
391
 
392
392
  it 'a default format - right aligned' do
393
393
  expect(subject).to receive(:puts).with(/^ *#{timestamp_regex}$/)
394
- subject.datetime(:align => 'right')
394
+ subject.datetime(align: 'right')
395
395
  end
396
396
 
397
397
  it 'a default format - center aligned' do
398
398
  expect(subject).to receive(:puts).with(/^ *#{timestamp_regex} *$/)
399
- subject.datetime(:align => 'center')
399
+ subject.datetime(align: 'center')
400
400
  end
401
401
 
402
402
  it 'a modified format' do
403
- expect(subject).to receive(:puts).with(/^\d{2}\/\d{2}\/\d{2} *$/)
404
- 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')
405
405
  end
406
406
  end
407
407
 
408
408
  it 'outputs color' do
409
409
  expect(subject).to receive(:puts).with(/^\e\[31m#{timestamp_regex}\e\[0m/)
410
- subject.datetime(:color => 'red')
410
+ subject.datetime(color: 'red')
411
411
  end
412
412
 
413
413
  it 'outputs bold' do
414
414
  expect(subject).to receive(:puts).with(/^\e\[1m#{timestamp_regex}\e\[0m/)
415
- subject.datetime(:bold => true)
415
+ subject.datetime(bold: true)
416
416
  end
417
417
  end
418
418
 
419
419
  describe '#aligned' do
420
420
  context 'argument validation' do
421
421
  it 'accepts align' do
422
- expect {
422
+ expect do
423
423
  allow(subject).to receive(:puts)
424
- subject.aligned('test', :align => 'left')
425
- }.to_not raise_error
424
+ subject.aligned('test', align: 'left')
425
+ end.to_not raise_error Exception
426
426
  end
427
427
 
428
428
  it 'does not allow invalid align values' do
429
- expect {
430
- subject.aligned('test', :align => 1234)
431
- }.to raise_error ArgumentError
429
+ expect do
430
+ subject.aligned('test', align: 1234)
431
+ end.to raise_error NoMethodError
432
432
  end
433
433
 
434
434
  it 'accepts width' do
435
- expect {
435
+ expect do
436
436
  allow(subject).to receive(:puts)
437
- subject.aligned('test', :width => 40)
438
- }.to_not raise_error
437
+ subject.aligned('test', width: 40)
438
+ end.to_not raise_error Exception
439
439
  end
440
440
 
441
441
  it 'does not allow invalid width values' do
442
- expect {
443
- subject.aligned('test', :align => 'right', :width => 'asdf')
444
- }.to raise_error
442
+ expect do
443
+ subject.aligned('test', align: 'right', width: 'asdf')
444
+ end.to raise_error Exception
445
445
  end
446
446
  end
447
447
 
448
448
  it 'outputs color' do
449
449
  expect(subject).to receive(:puts).with(controls[:red] + 'x' * 10 + controls[:clear])
450
- subject.aligned('x' * 10, :color => 'red')
450
+ subject.aligned('x' * 10, color: 'red')
451
451
  end
452
452
 
453
453
  it 'outputs bold' do
454
454
  expect(subject).to receive(:puts).with(controls[:bold] + 'x' * 10 + controls[:clear])
455
- subject.aligned('x' * 10, :bold => true)
455
+ subject.aligned('x' * 10, bold: true)
456
456
  end
457
-
458
457
  end
459
458
 
460
459
  describe '#footer' do
461
460
  context 'argument validation' do
462
461
  it 'accepts title' do
463
- expect {
462
+ expect do
464
463
  allow(subject).to receive(:puts)
465
- subject.footer(:title => 'test')
466
- }.to_not raise_error
464
+ subject.footer(title: 'test')
465
+ end.to_not raise_error Exception
467
466
  end
468
467
 
469
468
  it 'accepts align' do
470
- expect {
469
+ expect do
471
470
  allow(subject).to receive(:puts)
472
- subject.footer(:align => 'right')
473
- }.to_not raise_error
471
+ subject.footer(align: 'right')
472
+ end.to_not raise_error Exception
474
473
  end
475
474
 
476
475
  it 'does not accept invalid align' do
477
- expect {
478
- subject.header(:align => 1234)
479
- }.to raise_error ArgumentError
476
+ expect do
477
+ subject.header(align: 1234)
478
+ end.to raise_error NoMethodError
480
479
  end
481
480
 
482
481
  it 'accepts width' do
483
- expect {
482
+ expect do
484
483
  allow(subject).to receive(:puts)
485
- subject.footer(:width => 50)
486
- }.to_not raise_error
484
+ subject.footer(width: 50)
485
+ end.to_not raise_error Exception
487
486
  end
488
487
 
489
488
  it 'does not accept invalid width' do
490
- expect {
491
- subject.footer(:width => 'asdf')
492
- }.to raise_error ArgumentError
489
+ expect do
490
+ subject.footer(width: 'asdf')
491
+ end.to raise_error ArgumentError
493
492
  end
494
493
 
495
494
  it 'does not allow title > width' do
496
- expect {
497
- subject.footer(:title => 'testtesttest', :width => 6)
498
- }.to raise_error ArgumentError
495
+ expect do
496
+ subject.footer(title: 'testtesttest', width: 6)
497
+ end.to raise_error ArgumentError
499
498
  end
500
499
 
501
500
  it 'accepts spacing' do
502
- expect {
501
+ expect do
503
502
  allow(subject).to receive(:puts)
504
- subject.footer(:spacing => 3)
505
- }.to_not raise_error
503
+ subject.footer(spacing: 3)
504
+ end.to_not raise_error Exception
506
505
  end
507
506
  end
508
507
 
@@ -514,37 +513,37 @@ describe CommandLineReporter do
514
513
  it 'left aligns the title by default' do
515
514
  expect(subject).to receive(:puts).with("\n")
516
515
  expect(subject).to receive(:puts).with(@title)
517
- subject.footer(:title => @title)
516
+ subject.footer(title: @title)
518
517
  end
519
518
 
520
519
  it 'left aligns the title' do
521
520
  expect(subject).to receive(:puts).with("\n")
522
521
  expect(subject).to receive(:puts).with(@title)
523
- subject.footer(:title => @title, :align => 'left')
522
+ subject.footer(title: @title, align: 'left')
524
523
  end
525
524
 
526
525
  it 'right aligns the title' do
527
526
  expect(subject).to receive(:puts).with("\n")
528
527
  expect(subject).to receive(:puts).with(' ' * 90 + @title)
529
- subject.footer(:title => @title, :align => 'right')
528
+ subject.footer(title: @title, align: 'right')
530
529
  end
531
530
 
532
531
  it 'right aligns the title using width' do
533
532
  expect(subject).to receive(:puts).with("\n")
534
533
  expect(subject).to receive(:puts).with(' ' * 40 + @title)
535
- subject.footer(:title => @title, :align => 'right', :width => 50)
534
+ subject.footer(title: @title, align: 'right', width: 50)
536
535
  end
537
536
 
538
537
  it 'center aligns the title' do
539
538
  expect(subject).to receive(:puts).with("\n")
540
539
  expect(subject).to receive(:puts).with(' ' * 45 + @title)
541
- subject.footer(:title => @title, :align => 'center')
540
+ subject.footer(title: @title, align: 'center')
542
541
  end
543
542
 
544
543
  it 'center aligns the title using width' do
545
544
  expect(subject).to receive(:puts).with("\n")
546
545
  expect(subject).to receive(:puts).with(' ' * 35 + @title)
547
- subject.footer(:title => @title, :align => 'center', :width => 80)
546
+ subject.footer(title: @title, align: 'center', width: 80)
548
547
  end
549
548
  end
550
549
 
@@ -552,13 +551,13 @@ describe CommandLineReporter do
552
551
  it 'defaults to a single line of spacing between report' do
553
552
  expect(subject).to receive(:puts).with("\n")
554
553
  expect(subject).to receive(:puts).with('title')
555
- subject.footer(:title => 'title')
554
+ subject.footer(title: 'title')
556
555
  end
557
556
 
558
557
  it 'uses the defined spacing between report' do
559
558
  expect(subject).to receive(:puts).with("\n" * 3)
560
559
  expect(subject).to receive(:puts).with('title')
561
- subject.footer(:title => 'title', :spacing => 3)
560
+ subject.footer(title: 'title', spacing: 3)
562
561
  end
563
562
  end
564
563
 
@@ -567,21 +566,21 @@ describe CommandLineReporter do
567
566
  expect(subject).to receive(:puts).with("\n")
568
567
  expect(subject).to receive(:puts).with('title')
569
568
  expect(subject).to receive(:puts).with(/^#{timestamp_regex}/)
570
- subject.footer(:title => 'title', :timestamp => true)
569
+ subject.footer(title: 'title', timestamp: true)
571
570
  end
572
571
 
573
572
  it 'added with right alignment' do
574
573
  expect(subject).to receive(:puts).with("\n")
575
574
  expect(subject).to receive(:puts).with(/^ *title$/)
576
575
  expect(subject).to receive(:puts).with(/^ *#{timestamp_regex}$/)
577
- subject.footer(:title => 'title', :align => 'right', :timestamp => true, :width => 80)
576
+ subject.footer(title: 'title', align: 'right', timestamp: true, width: 80)
578
577
  end
579
578
 
580
579
  it 'added with center alignment' do
581
580
  expect(subject).to receive(:puts).with("\n")
582
581
  expect(subject).to receive(:puts).with(/^ *title *$/)
583
582
  expect(subject).to receive(:puts).with(/^ *#{timestamp_regex} *$/)
584
- subject.footer(:title => 'title', :align => 'center', :timestamp => true, :width => 80)
583
+ subject.footer(title: 'title', align: 'center', timestamp: true, width: 80)
585
584
  end
586
585
  end
587
586
 
@@ -590,14 +589,14 @@ describe CommandLineReporter do
590
589
  expect(subject).to receive(:puts)
591
590
  expect(subject).to receive(:puts).with(linechar * 100)
592
591
  expect(subject).to receive(:puts)
593
- subject.footer(:rule => true)
592
+ subject.footer(rule: true)
594
593
  end
595
594
 
596
595
  it 'uses = as the rule character' do
597
596
  expect(subject).to receive(:puts)
598
597
  expect(subject).to receive(:puts).with('=' * 100)
599
598
  expect(subject).to receive(:puts)
600
- subject.footer(:rule => '=')
599
+ subject.footer(rule: '=')
601
600
  end
602
601
  end
603
602
 
@@ -605,14 +604,14 @@ describe CommandLineReporter do
605
604
  expect(subject).to receive(:puts).with("\n")
606
605
  expect(subject).to receive(:puts).with(controls[:red] + 'title' + controls[:clear])
607
606
  expect(subject).to receive(:puts).with(/^\e\[31m#{timestamp_regex}\e\[0m/)
608
- subject.footer(:title => 'title', :timestamp => true, :color => 'red')
607
+ subject.footer(title: 'title', timestamp: true, color: 'red')
609
608
  end
610
609
 
611
610
  it 'outputs bold' do
612
611
  expect(subject).to receive(:puts).with("\n")
613
612
  expect(subject).to receive(:puts).with(controls[:bold] + 'title' + controls[:clear])
614
613
  expect(subject).to receive(:puts).with(/^\e\[1m#{timestamp_regex}\e\[0m/)
615
- subject.footer(:title => 'title', :timestamp => true, :bold => true)
614
+ subject.footer(title: 'title', timestamp: true, bold: true)
616
615
  end
617
616
  end
618
617
 
@@ -620,26 +619,26 @@ describe CommandLineReporter do
620
619
  it 'instantiates the table class' do
621
620
  allow(subject).to receive(:puts)
622
621
  expect(subject).to receive(:table).once
623
- subject.table { }
622
+ subject.table {}
624
623
  end
625
624
 
626
625
  it 'requires a row to be defined' do
627
- expect {
626
+ expect do
628
627
  subject.table
629
- }.to raise_error LocalJumpError
628
+ end.to raise_error LocalJumpError
630
629
  end
631
630
 
632
631
  it 'accepts valid options' do
633
- expect {
634
- subject.table(:border => true) { }
635
- }.to_not raise_error
632
+ expect do
633
+ subject.table(border: true) {}
634
+ end.to_not raise_error Exception
636
635
  end
637
636
 
638
637
  it 'rejects invalid options' do
639
- expect {
638
+ expect do
640
639
  allow(subject).to receive(:puts)
641
- subject.table(:asdf => '100') { }
642
- }.to raise_error ArgumentError
640
+ subject.table(asdf: '100') {}
641
+ end.to raise_error ArgumentError
643
642
  end
644
643
  end
645
644
 
@@ -675,21 +674,20 @@ describe CommandLineReporter do
675
674
 
676
675
  subject.table do
677
676
  subject.row do
678
- subject.column('asdf', :width => 30)
677
+ subject.column('asdf', width: 30)
679
678
  end
680
679
  end
681
680
  end
682
681
 
683
682
  it 'rejects invalid options' do
684
683
  allow(subject).to receive(:puts)
685
- expect {
684
+ expect do
686
685
  subject.table do
687
686
  subject.row do
688
- subject.column('asdf', :asdf => 30)
687
+ subject.column('asdf', asdf: 30)
689
688
  end
690
689
  end
691
- }.to raise_error ArgumentError
690
+ end.to raise_error ArgumentError
692
691
  end
693
692
  end
694
-
695
693
  end