puppet-lint 4.1.0 → 4.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +18 -4
  3. data/lib/puppet-lint/lexer.rb +2 -2
  4. data/lib/puppet-lint/plugins/legacy_facts/legacy_facts.rb +2 -2
  5. data/lib/puppet-lint/plugins/top_scope_facts/top_scope_facts.rb +4 -4
  6. data/lib/puppet-lint/version.rb +1 -1
  7. data/rubocop_baseline.yml +7 -0
  8. data/spec/spec_helper.rb +0 -1
  9. data/spec/unit/puppet-lint/checks_spec.rb +7 -2
  10. data/spec/unit/puppet-lint/ignore_overrides_spec.rb +6 -6
  11. data/spec/unit/puppet-lint/lexer_spec.rb +702 -699
  12. data/spec/unit/puppet-lint/plugins/check_classes/arrow_on_right_operand_line_spec.rb +5 -5
  13. data/spec/unit/puppet-lint/plugins/check_classes/autoloader_layout_spec.rb +8 -8
  14. data/spec/unit/puppet-lint/plugins/check_classes/class_inherits_from_params_class_spec.rb +2 -2
  15. data/spec/unit/puppet-lint/plugins/check_classes/code_on_top_scope_spec.rb +2 -1
  16. data/spec/unit/puppet-lint/plugins/check_classes/inherits_across_namespaces_spec.rb +3 -3
  17. data/spec/unit/puppet-lint/plugins/check_classes/name_contains_uppercase_spec.rb +3 -3
  18. data/spec/unit/puppet-lint/plugins/check_classes/names_containing_dash_spec.rb +3 -3
  19. data/spec/unit/puppet-lint/plugins/check_classes/nested_classes_or_defines_spec.rb +5 -5
  20. data/spec/unit/puppet-lint/plugins/check_classes/parameter_order_spec.rb +14 -14
  21. data/spec/unit/puppet-lint/plugins/check_classes/right_to_left_relationship_spec.rb +2 -2
  22. data/spec/unit/puppet-lint/plugins/check_classes/variable_scope_spec.rb +21 -21
  23. data/spec/unit/puppet-lint/plugins/check_comments/slash_comments_spec.rb +2 -2
  24. data/spec/unit/puppet-lint/plugins/check_comments/star_comments_spec.rb +4 -4
  25. data/spec/unit/puppet-lint/plugins/check_conditionals/case_without_default_spec.rb +6 -6
  26. data/spec/unit/puppet-lint/plugins/check_conditionals/selector_inside_resource_spec.rb +2 -2
  27. data/spec/unit/puppet-lint/plugins/check_documentation/documentation_spec.rb +5 -5
  28. data/spec/unit/puppet-lint/plugins/check_nodes/unquoted_node_name_spec.rb +11 -11
  29. data/spec/unit/puppet-lint/plugins/check_resources/duplicate_params_spec.rb +6 -6
  30. data/spec/unit/puppet-lint/plugins/check_resources/ensure_first_param_spec.rb +12 -12
  31. data/spec/unit/puppet-lint/plugins/check_resources/ensure_not_symlink_target_spec.rb +4 -4
  32. data/spec/unit/puppet-lint/plugins/check_resources/file_mode_spec.rb +22 -22
  33. data/spec/unit/puppet-lint/plugins/check_resources/unquoted_file_mode_spec.rb +8 -8
  34. data/spec/unit/puppet-lint/plugins/check_resources/unquoted_resource_title_spec.rb +13 -13
  35. data/spec/unit/puppet-lint/plugins/check_strings/double_quoted_strings_spec.rb +18 -18
  36. data/spec/unit/puppet-lint/plugins/check_strings/only_variable_string_spec.rb +6 -6
  37. data/spec/unit/puppet-lint/plugins/check_strings/puppet_url_without_modules_spec.rb +4 -4
  38. data/spec/unit/puppet-lint/plugins/check_strings/quoted_booleans_spec.rb +8 -8
  39. data/spec/unit/puppet-lint/plugins/check_strings/single_quote_string_with_variables_spec.rb +3 -3
  40. data/spec/unit/puppet-lint/plugins/check_strings/variables_not_enclosed_spec.rb +7 -7
  41. data/spec/unit/puppet-lint/plugins/check_variables/variable_contains_dash_spec.rb +2 -2
  42. data/spec/unit/puppet-lint/plugins/check_variables/variable_is_lowercase_spec.rb +5 -5
  43. data/spec/unit/puppet-lint/plugins/check_whitespace/140chars_spec.rb +4 -4
  44. data/spec/unit/puppet-lint/plugins/check_whitespace/2sp_soft_tabs_spec.rb +1 -1
  45. data/spec/unit/puppet-lint/plugins/check_whitespace/80chars_spec.rb +4 -4
  46. data/spec/unit/puppet-lint/plugins/check_whitespace/arrow_alignment_spec.rb +37 -37
  47. data/spec/unit/puppet-lint/plugins/check_whitespace/hard_tabs_spec.rb +2 -2
  48. data/spec/unit/puppet-lint/plugins/check_whitespace/trailing_whitespace_spec.rb +6 -6
  49. data/spec/unit/puppet-lint/plugins/legacy_facts/legacy_facts_spec.rb +83 -75
  50. data/spec/unit/puppet-lint/plugins/top_scope_facts/top_scope_facts_spec.rb +19 -19
  51. metadata +6 -6
  52. data/lib/puppet-lint/plugins/check_unsafe_interpolations/check_unsafe_interpolations.rb +0 -130
  53. data/spec/unit/puppet-lint/plugins/check_unsafe_interpolations/check_unsafe_interpolations_spec.rb +0 -186
@@ -78,12 +78,13 @@ describe PuppetLint::Lexer do
78
78
  end
79
79
 
80
80
  it 'creates a :STRING token' do
81
- expect(tokens).to have(1).token
82
- expect(tokens[0]).to have_attributes(
83
- type: :STRING,
84
- value: '',
85
- line: 1,
86
- column: 1,
81
+ expect(tokens).to contain_exactly(
82
+ have_attributes(
83
+ type: :STRING,
84
+ value: '',
85
+ line: 1,
86
+ column: 1,
87
+ ),
87
88
  )
88
89
  end
89
90
 
@@ -102,24 +103,25 @@ describe PuppetLint::Lexer do
102
103
  end
103
104
 
104
105
  it 'creates a tokenised string with an interpolated variable' do
105
- expect(tokens).to have(3).tokens
106
- expect(tokens[0]).to have_attributes(
107
- type: :DQPRE,
108
- value: '',
109
- line: 1,
110
- column: 1,
111
- )
112
- expect(tokens[1]).to have_attributes(
113
- type: :VARIABLE,
114
- value: 'foo',
115
- line: 1,
116
- column: 4,
117
- )
118
- expect(tokens[2]).to have_attributes(
119
- type: :DQPOST,
120
- value: 'bar',
121
- line: 1,
122
- column: 7,
106
+ expect(tokens).to contain_exactly(
107
+ have_attributes(
108
+ type: :DQPRE,
109
+ value: '',
110
+ line: 1,
111
+ column: 1,
112
+ ),
113
+ have_attributes(
114
+ type: :VARIABLE,
115
+ value: 'foo',
116
+ line: 1,
117
+ column: 4,
118
+ ),
119
+ have_attributes(
120
+ type: :DQPOST,
121
+ value: 'bar',
122
+ line: 1,
123
+ column: 7,
124
+ ),
123
125
  )
124
126
  end
125
127
 
@@ -138,24 +140,25 @@ describe PuppetLint::Lexer do
138
140
  end
139
141
 
140
142
  it 'creates a tokenised string with an interpolated variable' do
141
- expect(tokens).to have(3).tokens
142
- expect(tokens[0]).to have_attributes(
143
- type: :DQPRE,
144
- value: 'foo',
145
- line: 1,
146
- column: 1,
147
- )
148
- expect(tokens[1]).to have_attributes(
149
- type: :VARIABLE,
150
- value: 'bar',
151
- line: 1,
152
- column: 7,
153
- )
154
- expect(tokens[2]).to have_attributes(
155
- type: :DQPOST,
156
- value: 'baz',
157
- line: 1,
158
- column: 10,
143
+ expect(tokens).to contain_exactly(
144
+ have_attributes(
145
+ type: :DQPRE,
146
+ value: 'foo',
147
+ line: 1,
148
+ column: 1,
149
+ ),
150
+ have_attributes(
151
+ type: :VARIABLE,
152
+ value: 'bar',
153
+ line: 1,
154
+ column: 7,
155
+ ),
156
+ have_attributes(
157
+ type: :DQPOST,
158
+ value: 'baz',
159
+ line: 1,
160
+ column: 10,
161
+ ),
159
162
  )
160
163
  end
161
164
 
@@ -176,37 +179,37 @@ describe PuppetLint::Lexer do
176
179
  end
177
180
 
178
181
  it 'creates a tokenised string with the interpolated variables' do
179
- expect(tokens).to have(5).tokens
180
-
181
- expect(tokens[0]).to have_attributes(
182
- type: :DQPRE,
183
- value: 'foo',
184
- line: 1,
185
- column: 1,
186
- )
187
- expect(tokens[1]).to have_attributes(
188
- type: :VARIABLE,
189
- value: 'bar',
190
- line: 1,
191
- column: 7,
192
- )
193
- expect(tokens[2]).to have_attributes(
194
- type: :DQMID,
195
- value: 'baz',
196
- line: 1,
197
- column: 10,
198
- )
199
- expect(tokens[3]).to have_attributes(
200
- type: :VARIABLE,
201
- value: 'gronk',
202
- line: 1,
203
- column: 16,
204
- )
205
- expect(tokens[4]).to have_attributes(
206
- type: :DQPOST,
207
- value: 'meh',
208
- line: 1,
209
- column: 21,
182
+ expect(tokens).to contain_exactly(
183
+ have_attributes(
184
+ type: :DQPRE,
185
+ value: 'foo',
186
+ line: 1,
187
+ column: 1,
188
+ ),
189
+ have_attributes(
190
+ type: :VARIABLE,
191
+ value: 'bar',
192
+ line: 1,
193
+ column: 7,
194
+ ),
195
+ have_attributes(
196
+ type: :DQMID,
197
+ value: 'baz',
198
+ line: 1,
199
+ column: 10,
200
+ ),
201
+ have_attributes(
202
+ type: :VARIABLE,
203
+ value: 'gronk',
204
+ line: 1,
205
+ column: 16,
206
+ ),
207
+ have_attributes(
208
+ type: :DQPOST,
209
+ value: 'meh',
210
+ line: 1,
211
+ column: 21,
212
+ ),
210
213
  )
211
214
  end
212
215
 
@@ -225,25 +228,25 @@ describe PuppetLint::Lexer do
225
228
  end
226
229
 
227
230
  it 'creates a tokenised string' do
228
- expect(tokens).to have(3).tokens
229
-
230
- expect(tokens[0]).to have_attributes(
231
- type: :DQPRE,
232
- value: '',
233
- line: 1,
234
- column: 1,
235
- )
236
- expect(tokens[1]).to have_attributes(
237
- type: :VARIABLE,
238
- value: 'foo',
239
- line: 1,
240
- column: 4,
241
- )
242
- expect(tokens[2]).to have_attributes(
243
- type: :DQPOST,
244
- value: '',
245
- line: 1,
246
- column: 7,
231
+ expect(tokens).to contain_exactly(
232
+ have_attributes(
233
+ type: :DQPRE,
234
+ value: '',
235
+ line: 1,
236
+ column: 1,
237
+ ),
238
+ have_attributes(
239
+ type: :VARIABLE,
240
+ value: 'foo',
241
+ line: 1,
242
+ column: 4,
243
+ ),
244
+ have_attributes(
245
+ type: :DQPOST,
246
+ value: '',
247
+ line: 1,
248
+ column: 7,
249
+ ),
247
250
  )
248
251
  end
249
252
 
@@ -264,25 +267,25 @@ describe PuppetLint::Lexer do
264
267
  end
265
268
 
266
269
  it 'creates a tokenised string' do
267
- expect(tokens).to have(3).tokens
268
-
269
- expect(tokens[0]).to have_attributes(
270
- type: :DQPRE,
271
- value: '',
272
- line: 1,
273
- column: 1,
274
- )
275
- expect(tokens[1]).to have_attributes(
276
- type: :VARIABLE,
277
- value: keyword,
278
- line: 1,
279
- column: 4,
280
- )
281
- expect(tokens[2]).to have_attributes(
282
- type: :DQPOST,
283
- value: '',
284
- line: 1,
285
- column: keyword.size + 4,
270
+ expect(tokens).to contain_exactly(
271
+ have_attributes(
272
+ type: :DQPRE,
273
+ value: '',
274
+ line: 1,
275
+ column: 1,
276
+ ),
277
+ have_attributes(
278
+ type: :VARIABLE,
279
+ value: keyword,
280
+ line: 1,
281
+ column: 4,
282
+ ),
283
+ have_attributes(
284
+ type: :DQPOST,
285
+ value: '',
286
+ line: 1,
287
+ column: keyword.size + 4,
288
+ ),
286
289
  )
287
290
  end
288
291
 
@@ -303,25 +306,25 @@ describe PuppetLint::Lexer do
303
306
  end
304
307
 
305
308
  it 'creates a tokenised string' do
306
- expect(tokens).to have(3).tokens
307
-
308
- expect(tokens[0]).to have_attributes(
309
- type: :DQPRE,
310
- value: '',
311
- line: 1,
312
- column: 1,
313
- )
314
- expect(tokens[1]).to have_attributes(
315
- type: :VARIABLE,
316
- value: 'bar',
317
- line: 1,
318
- column: 4,
319
- )
320
- expect(tokens[2]).to have_attributes(
321
- type: :DQPOST,
322
- value: '',
323
- line: 1,
324
- column: 8,
309
+ expect(tokens).to contain_exactly(
310
+ have_attributes(
311
+ type: :DQPRE,
312
+ value: '',
313
+ line: 1,
314
+ column: 1,
315
+ ),
316
+ have_attributes(
317
+ type: :VARIABLE,
318
+ value: 'bar',
319
+ line: 1,
320
+ column: 4,
321
+ ),
322
+ have_attributes(
323
+ type: :DQPOST,
324
+ value: '',
325
+ line: 1,
326
+ column: 8,
327
+ ),
325
328
  )
326
329
  end
327
330
 
@@ -340,61 +343,61 @@ describe PuppetLint::Lexer do
340
343
  end
341
344
 
342
345
  it 'creates a tokenised string' do
343
- expect(tokens).to have(9).tokens
344
-
345
- expect(tokens[0]).to have_attributes(
346
- type: :DQPRE,
347
- value: '',
348
- line: 1,
349
- column: 1,
350
- )
351
- expect(tokens[1]).to have_attributes(
352
- type: :VARIABLE,
353
- value: 'foo',
354
- line: 1,
355
- column: 4,
356
- )
357
- expect(tokens[2]).to have_attributes(
358
- type: :LBRACK,
359
- value: '[',
360
- line: 1,
361
- column: 7,
362
- )
363
- expect(tokens[3]).to have_attributes(
364
- type: :NAME,
365
- value: 'bar',
366
- line: 1,
367
- column: 8,
368
- )
369
- expect(tokens[4]).to have_attributes(
370
- type: :RBRACK,
371
- value: ']',
372
- line: 1,
373
- column: 11,
374
- )
375
- expect(tokens[5]).to have_attributes(
376
- type: :LBRACK,
377
- value: '[',
378
- line: 1,
379
- column: 12,
380
- )
381
- expect(tokens[6]).to have_attributes(
382
- type: :NAME,
383
- value: 'baz',
384
- line: 1,
385
- column: 13,
386
- )
387
- expect(tokens[7]).to have_attributes(
388
- type: :RBRACK,
389
- value: ']',
390
- line: 1,
391
- column: 16,
392
- )
393
- expect(tokens[8]).to have_attributes(
394
- type: :DQPOST,
395
- value: '',
396
- line: 1,
397
- column: 17,
346
+ expect(tokens).to contain_exactly(
347
+ have_attributes(
348
+ type: :DQPRE,
349
+ value: '',
350
+ line: 1,
351
+ column: 1,
352
+ ),
353
+ have_attributes(
354
+ type: :VARIABLE,
355
+ value: 'foo',
356
+ line: 1,
357
+ column: 4,
358
+ ),
359
+ have_attributes(
360
+ type: :LBRACK,
361
+ value: '[',
362
+ line: 1,
363
+ column: 7,
364
+ ),
365
+ have_attributes(
366
+ type: :NAME,
367
+ value: 'bar',
368
+ line: 1,
369
+ column: 8,
370
+ ),
371
+ have_attributes(
372
+ type: :RBRACK,
373
+ value: ']',
374
+ line: 1,
375
+ column: 11,
376
+ ),
377
+ have_attributes(
378
+ type: :LBRACK,
379
+ value: '[',
380
+ line: 1,
381
+ column: 12,
382
+ ),
383
+ have_attributes(
384
+ type: :NAME,
385
+ value: 'baz',
386
+ line: 1,
387
+ column: 13,
388
+ ),
389
+ have_attributes(
390
+ type: :RBRACK,
391
+ value: ']',
392
+ line: 1,
393
+ column: 16,
394
+ ),
395
+ have_attributes(
396
+ type: :DQPOST,
397
+ value: '',
398
+ line: 1,
399
+ column: 17,
400
+ ),
398
401
  )
399
402
  end
400
403
 
@@ -415,37 +418,37 @@ describe PuppetLint::Lexer do
415
418
  end
416
419
 
417
420
  it 'creates a tokenised string' do
418
- expect(tokens).to have(5).tokens
419
-
420
- expect(tokens[0]).to have_attributes(
421
- type: :DQPRE,
422
- value: '',
423
- line: 1,
424
- column: 1,
425
- )
426
- expect(tokens[1]).to have_attributes(
427
- type: :VARIABLE,
428
- value: 'foo',
429
- line: 1,
430
- column: 4,
431
- )
432
- expect(tokens[2]).to have_attributes(
433
- type: :DQMID,
434
- value: '',
435
- line: 1,
436
- column: 7,
437
- )
438
- expect(tokens[3]).to have_attributes(
439
- type: :VARIABLE,
440
- value: 'bar',
441
- line: 1,
442
- column: 10,
443
- )
444
- expect(tokens[4]).to have_attributes(
445
- type: :DQPOST,
446
- value: '',
447
- line: 1,
448
- column: 13,
421
+ expect(tokens).to contain_exactly(
422
+ have_attributes(
423
+ type: :DQPRE,
424
+ value: '',
425
+ line: 1,
426
+ column: 1,
427
+ ),
428
+ have_attributes(
429
+ type: :VARIABLE,
430
+ value: 'foo',
431
+ line: 1,
432
+ column: 4,
433
+ ),
434
+ have_attributes(
435
+ type: :DQMID,
436
+ value: '',
437
+ line: 1,
438
+ column: 7,
439
+ ),
440
+ have_attributes(
441
+ type: :VARIABLE,
442
+ value: 'bar',
443
+ line: 1,
444
+ column: 10,
445
+ ),
446
+ have_attributes(
447
+ type: :DQPOST,
448
+ value: '',
449
+ line: 1,
450
+ column: 13,
451
+ ),
449
452
  )
450
453
  end
451
454
 
@@ -464,25 +467,25 @@ describe PuppetLint::Lexer do
464
467
  end
465
468
 
466
469
  it 'creates a tokenised string' do
467
- expect(tokens).to have(3).tokens
468
-
469
- expect(tokens[0]).to have_attributes(
470
- type: :DQPRE,
471
- value: '',
472
- line: 1,
473
- column: 1,
474
- )
475
- expect(tokens[1]).to have_attributes(
476
- type: :UNENC_VARIABLE,
477
- value: 'foo',
478
- line: 1,
479
- column: 2,
480
- )
481
- expect(tokens[2]).to have_attributes(
482
- type: :DQPOST,
483
- value: '',
484
- line: 1,
485
- column: 6,
470
+ expect(tokens).to contain_exactly(
471
+ have_attributes(
472
+ type: :DQPRE,
473
+ value: '',
474
+ line: 1,
475
+ column: 1,
476
+ ),
477
+ have_attributes(
478
+ type: :UNENC_VARIABLE,
479
+ value: 'foo',
480
+ line: 1,
481
+ column: 2,
482
+ ),
483
+ have_attributes(
484
+ type: :DQPOST,
485
+ value: '',
486
+ line: 1,
487
+ column: 6,
488
+ ),
486
489
  )
487
490
  end
488
491
 
@@ -501,25 +504,25 @@ describe PuppetLint::Lexer do
501
504
  end
502
505
 
503
506
  it 'creates a tokenised string' do
504
- expect(tokens).to have(3).tokens
505
-
506
- expect(tokens[0]).to have_attributes(
507
- type: :DQPRE,
508
- value: 'string with ',
509
- line: 1,
510
- column: 1,
511
- )
512
- expect(tokens[1]).to have_attributes(
513
- type: :SSTRING,
514
- value: 'a nested single quoted string',
515
- line: 1,
516
- column: 16,
517
- )
518
- expect(tokens[2]).to have_attributes(
519
- type: :DQPOST,
520
- value: ' inside it',
521
- line: 1,
522
- column: 47,
507
+ expect(tokens).to contain_exactly(
508
+ have_attributes(
509
+ type: :DQPRE,
510
+ value: 'string with ',
511
+ line: 1,
512
+ column: 1,
513
+ ),
514
+ have_attributes(
515
+ type: :SSTRING,
516
+ value: 'a nested single quoted string',
517
+ line: 1,
518
+ column: 16,
519
+ ),
520
+ have_attributes(
521
+ type: :DQPOST,
522
+ value: ' inside it',
523
+ line: 1,
524
+ column: 47,
525
+ ),
523
526
  )
524
527
  end
525
528
 
@@ -538,61 +541,61 @@ describe PuppetLint::Lexer do
538
541
  end
539
542
 
540
543
  it 'creates a tokenised string' do
541
- expect(tokens).to have(9).tokens
542
-
543
- expect(tokens[0]).to have_attributes(
544
- type: :DQPRE,
545
- value: 'string with ',
546
- line: 1,
547
- column: 1,
548
- )
549
- expect(tokens[1]).to have_attributes(
550
- type: :LPAREN,
551
- value: '(',
552
- line: 1,
553
- column: 16,
554
- )
555
- expect(tokens[2]).to have_attributes(
556
- type: :NUMBER,
557
- value: '3',
558
- line: 1,
559
- column: 17,
560
- )
561
- expect(tokens[3]).to have_attributes(
562
- type: :PLUS,
563
- value: '+',
564
- line: 1,
565
- column: 18,
566
- )
567
- expect(tokens[4]).to have_attributes(
568
- type: :NUMBER,
569
- value: '5',
570
- line: 1,
571
- column: 19,
572
- )
573
- expect(tokens[5]).to have_attributes(
574
- type: :RPAREN,
575
- value: ')',
576
- line: 1,
577
- column: 20,
578
- )
579
- expect(tokens[6]).to have_attributes(
580
- type: :DIV,
581
- value: '/',
582
- line: 1,
583
- column: 21,
584
- )
585
- expect(tokens[7]).to have_attributes(
586
- type: :NUMBER,
587
- value: '4',
588
- line: 1,
589
- column: 22,
590
- )
591
- expect(tokens[8]).to have_attributes(
592
- type: :DQPOST,
593
- value: ' nested math',
594
- line: 1,
595
- column: 23,
544
+ expect(tokens).to contain_exactly(
545
+ have_attributes(
546
+ type: :DQPRE,
547
+ value: 'string with ',
548
+ line: 1,
549
+ column: 1,
550
+ ),
551
+ have_attributes(
552
+ type: :LPAREN,
553
+ value: '(',
554
+ line: 1,
555
+ column: 16,
556
+ ),
557
+ have_attributes(
558
+ type: :NUMBER,
559
+ value: '3',
560
+ line: 1,
561
+ column: 17,
562
+ ),
563
+ have_attributes(
564
+ type: :PLUS,
565
+ value: '+',
566
+ line: 1,
567
+ column: 18,
568
+ ),
569
+ have_attributes(
570
+ type: :NUMBER,
571
+ value: '5',
572
+ line: 1,
573
+ column: 19,
574
+ ),
575
+ have_attributes(
576
+ type: :RPAREN,
577
+ value: ')',
578
+ line: 1,
579
+ column: 20,
580
+ ),
581
+ have_attributes(
582
+ type: :DIV,
583
+ value: '/',
584
+ line: 1,
585
+ column: 21,
586
+ ),
587
+ have_attributes(
588
+ type: :NUMBER,
589
+ value: '4',
590
+ line: 1,
591
+ column: 22,
592
+ ),
593
+ have_attributes(
594
+ type: :DQPOST,
595
+ value: ' nested math',
596
+ line: 1,
597
+ column: 23,
598
+ ),
596
599
  )
597
600
  end
598
601
 
@@ -611,55 +614,55 @@ describe PuppetLint::Lexer do
611
614
  end
612
615
 
613
616
  it 'creates a tokenised string' do
614
- expect(tokens).to have(8).tokens
615
-
616
- expect(tokens[0]).to have_attributes(
617
- type: :DQPRE,
618
- value: 'string with ',
619
- line: 1,
620
- column: 1,
621
- )
622
- expect(tokens[1]).to have_attributes(
623
- type: :LBRACK,
624
- value: '[',
625
- line: 1,
626
- column: 16,
627
- )
628
- expect(tokens[2]).to have_attributes(
629
- type: :SSTRING,
630
- value: 'an array ',
631
- line: 1,
632
- column: 17,
633
- )
634
- expect(tokens[3]).to have_attributes(
635
- type: :COMMA,
636
- value: ',',
637
- line: 1,
638
- column: 28,
639
- )
640
- expect(tokens[4]).to have_attributes(
641
- type: :WHITESPACE,
642
- value: ' ',
643
- line: 1,
644
- column: 29,
645
- )
646
- expect(tokens[5]).to have_attributes(
647
- type: :VARIABLE,
648
- value: 'v2',
649
- line: 1,
650
- column: 30,
651
- )
652
- expect(tokens[6]).to have_attributes(
653
- type: :RBRACK,
654
- value: ']',
655
- line: 1,
656
- column: 33,
657
- )
658
- expect(tokens[7]).to have_attributes(
659
- type: :DQPOST,
660
- value: ' in it',
661
- line: 1,
662
- column: 34,
617
+ expect(tokens).to contain_exactly(
618
+ have_attributes(
619
+ type: :DQPRE,
620
+ value: 'string with ',
621
+ line: 1,
622
+ column: 1,
623
+ ),
624
+ have_attributes(
625
+ type: :LBRACK,
626
+ value: '[',
627
+ line: 1,
628
+ column: 16,
629
+ ),
630
+ have_attributes(
631
+ type: :SSTRING,
632
+ value: 'an array ',
633
+ line: 1,
634
+ column: 17,
635
+ ),
636
+ have_attributes(
637
+ type: :COMMA,
638
+ value: ',',
639
+ line: 1,
640
+ column: 28,
641
+ ),
642
+ have_attributes(
643
+ type: :WHITESPACE,
644
+ value: ' ',
645
+ line: 1,
646
+ column: 29,
647
+ ),
648
+ have_attributes(
649
+ type: :VARIABLE,
650
+ value: 'v2',
651
+ line: 1,
652
+ column: 30,
653
+ ),
654
+ have_attributes(
655
+ type: :RBRACK,
656
+ value: ']',
657
+ line: 1,
658
+ column: 33,
659
+ ),
660
+ have_attributes(
661
+ type: :DQPOST,
662
+ value: ' in it',
663
+ line: 1,
664
+ column: 34,
665
+ ),
663
666
  )
664
667
  end
665
668
 
@@ -680,37 +683,37 @@ describe PuppetLint::Lexer do
680
683
  end
681
684
 
682
685
  it 'creates a tokenised string' do
683
- expect(tokens).to have(5).tokens
684
-
685
- expect(tokens[0]).to have_attributes(
686
- type: :DQPRE,
687
- value: '',
688
- line: 1,
689
- column: 1,
690
- )
691
- expect(tokens[1]).to have_attributes(
692
- type: :UNENC_VARIABLE,
693
- value: 'foo',
694
- line: 1,
695
- column: 2,
696
- )
697
- expect(tokens[2]).to have_attributes(
698
- type: :DQMID,
699
- value: '',
700
- line: 1,
701
- column: 6,
702
- )
703
- expect(tokens[3]).to have_attributes(
704
- type: :UNENC_VARIABLE,
705
- value: 'bar',
706
- line: 1,
707
- column: 6,
708
- )
709
- expect(tokens[4]).to have_attributes(
710
- type: :DQPOST,
711
- value: '',
712
- line: 1,
713
- column: 10,
686
+ expect(tokens).to contain_exactly(
687
+ have_attributes(
688
+ type: :DQPRE,
689
+ value: '',
690
+ line: 1,
691
+ column: 1,
692
+ ),
693
+ have_attributes(
694
+ type: :UNENC_VARIABLE,
695
+ value: 'foo',
696
+ line: 1,
697
+ column: 2,
698
+ ),
699
+ have_attributes(
700
+ type: :DQMID,
701
+ value: '',
702
+ line: 1,
703
+ column: 6,
704
+ ),
705
+ have_attributes(
706
+ type: :UNENC_VARIABLE,
707
+ value: 'bar',
708
+ line: 1,
709
+ column: 6,
710
+ ),
711
+ have_attributes(
712
+ type: :DQPOST,
713
+ value: '',
714
+ line: 1,
715
+ column: 10,
716
+ ),
714
717
  )
715
718
  end
716
719
 
@@ -729,25 +732,25 @@ describe PuppetLint::Lexer do
729
732
  end
730
733
 
731
734
  it 'creates a tokenised string' do
732
- expect(tokens).to have(3).tokens
733
-
734
- expect(tokens[0]).to have_attributes(
735
- type: :DQPRE,
736
- value: 'foo',
737
- line: 1,
738
- column: 1,
739
- )
740
- expect(tokens[1]).to have_attributes(
741
- type: :UNENC_VARIABLE,
742
- value: 'bar',
743
- line: 1,
744
- column: 5,
745
- )
746
- expect(tokens[2]).to have_attributes(
747
- type: :DQPOST,
748
- value: '$',
749
- line: 1,
750
- column: 9,
735
+ expect(tokens).to contain_exactly(
736
+ have_attributes(
737
+ type: :DQPRE,
738
+ value: 'foo',
739
+ line: 1,
740
+ column: 1,
741
+ ),
742
+ have_attributes(
743
+ type: :UNENC_VARIABLE,
744
+ value: 'bar',
745
+ line: 1,
746
+ column: 5,
747
+ ),
748
+ have_attributes(
749
+ type: :DQPOST,
750
+ value: '$',
751
+ line: 1,
752
+ column: 9,
753
+ ),
751
754
  )
752
755
  end
753
756
 
@@ -768,97 +771,97 @@ describe PuppetLint::Lexer do
768
771
  end
769
772
 
770
773
  it 'creates a tokenised string' do
771
- expect(tokens).to have(15).tokens
772
-
773
- expect(tokens[0]).to have_attributes(
774
- type: :DQPRE,
775
- value: '',
776
- line: 1,
777
- column: 1,
778
- )
779
- expect(tokens[1]).to have_attributes(
780
- type: :VARIABLE,
781
- value: 'key',
782
- line: 1,
783
- column: 4,
784
- )
785
- expect(tokens[2]).to have_attributes(
786
- type: :DQMID,
787
- value: ' ',
788
- line: 1,
789
- column: 7,
790
- )
791
- expect(tokens[3]).to have_attributes(
792
- type: :FUNCTION_NAME,
793
- value: 'flatten',
794
- line: 1,
795
- column: 11,
796
- )
797
- expect(tokens[4]).to have_attributes(
798
- type: :LPAREN,
799
- value: '(',
800
- line: 1,
801
- column: 18,
802
- )
803
- expect(tokens[5]).to have_attributes(
804
- type: :LBRACK,
805
- value: '[',
806
- line: 1,
807
- column: 19,
808
- )
809
- expect(tokens[6]).to have_attributes(
810
- type: :VARIABLE,
811
- value: 'value',
812
- line: 1,
813
- column: 20,
814
- )
815
- expect(tokens[7]).to have_attributes(
816
- type: :RBRACK,
817
- value: ']',
818
- line: 1,
819
- column: 26,
820
- )
821
- expect(tokens[8]).to have_attributes(
822
- type: :RPAREN,
823
- value: ')',
824
- line: 1,
825
- column: 27,
826
- )
827
- expect(tokens[9]).to have_attributes(
828
- type: :DOT,
829
- value: '.',
830
- line: 1,
831
- column: 28,
832
- )
833
- expect(tokens[10]).to have_attributes(
834
- type: :FUNCTION_NAME,
835
- value: 'join',
836
- line: 1,
837
- column: 29,
838
- )
839
- expect(tokens[11]).to have_attributes(
840
- type: :LPAREN,
841
- value: '(',
842
- line: 1,
843
- column: 33,
844
- )
845
- expect(tokens[12]).to have_attributes(
846
- type: :STRING,
847
- value: '\nkey ',
848
- line: 1,
849
- column: 34,
850
- )
851
- expect(tokens[13]).to have_attributes(
852
- type: :RPAREN,
853
- value: ')',
854
- line: 1,
855
- column: 42,
856
- )
857
- expect(tokens[14]).to have_attributes(
858
- type: :DQPOST,
859
- value: '',
860
- line: 1,
861
- column: 43,
774
+ expect(tokens).to contain_exactly(
775
+ have_attributes(
776
+ type: :DQPRE,
777
+ value: '',
778
+ line: 1,
779
+ column: 1,
780
+ ),
781
+ have_attributes(
782
+ type: :VARIABLE,
783
+ value: 'key',
784
+ line: 1,
785
+ column: 4,
786
+ ),
787
+ have_attributes(
788
+ type: :DQMID,
789
+ value: ' ',
790
+ line: 1,
791
+ column: 7,
792
+ ),
793
+ have_attributes(
794
+ type: :FUNCTION_NAME,
795
+ value: 'flatten',
796
+ line: 1,
797
+ column: 11,
798
+ ),
799
+ have_attributes(
800
+ type: :LPAREN,
801
+ value: '(',
802
+ line: 1,
803
+ column: 18,
804
+ ),
805
+ have_attributes(
806
+ type: :LBRACK,
807
+ value: '[',
808
+ line: 1,
809
+ column: 19,
810
+ ),
811
+ have_attributes(
812
+ type: :VARIABLE,
813
+ value: 'value',
814
+ line: 1,
815
+ column: 20,
816
+ ),
817
+ have_attributes(
818
+ type: :RBRACK,
819
+ value: ']',
820
+ line: 1,
821
+ column: 26,
822
+ ),
823
+ have_attributes(
824
+ type: :RPAREN,
825
+ value: ')',
826
+ line: 1,
827
+ column: 27,
828
+ ),
829
+ have_attributes(
830
+ type: :DOT,
831
+ value: '.',
832
+ line: 1,
833
+ column: 28,
834
+ ),
835
+ have_attributes(
836
+ type: :FUNCTION_NAME,
837
+ value: 'join',
838
+ line: 1,
839
+ column: 29,
840
+ ),
841
+ have_attributes(
842
+ type: :LPAREN,
843
+ value: '(',
844
+ line: 1,
845
+ column: 33,
846
+ ),
847
+ have_attributes(
848
+ type: :STRING,
849
+ value: '\nkey ',
850
+ line: 1,
851
+ column: 34,
852
+ ),
853
+ have_attributes(
854
+ type: :RPAREN,
855
+ value: ')',
856
+ line: 1,
857
+ column: 42,
858
+ ),
859
+ have_attributes(
860
+ type: :DQPOST,
861
+ value: '',
862
+ line: 1,
863
+ column: 43,
864
+ ),
862
865
  )
863
866
  end
864
867
 
@@ -879,97 +882,97 @@ describe PuppetLint::Lexer do
879
882
  end
880
883
 
881
884
  it 'creates a tokenised string' do
882
- expect(tokens).to have(15).tokens
883
-
884
- expect(tokens[0]).to have_attributes(
885
- type: :DQPRE,
886
- value: '',
887
- line: 1,
888
- column: 1,
889
- )
890
- expect(tokens[1]).to have_attributes(
891
- type: :VARIABLE,
892
- value: 'facts',
893
- line: 1,
894
- column: 4,
895
- )
896
- expect(tokens[2]).to have_attributes(
897
- type: :LBRACK,
898
- value: '[',
899
- line: 1,
900
- column: 9,
901
- )
902
- expect(tokens[3]).to have_attributes(
903
- type: :DQPRE,
904
- value: 'network_',
905
- line: 1,
906
- column: 10,
907
- )
908
- expect(tokens[4]).to have_attributes(
909
- type: :VARIABLE,
910
- value: 'iface',
911
- line: 1,
912
- column: 21,
913
- )
914
- expect(tokens[5]).to have_attributes(
915
- type: :DQPOST,
916
- value: '',
917
- line: 1,
918
- column: 26,
919
- )
920
- expect(tokens[6]).to have_attributes(
921
- type: :RBRACK,
922
- value: ']',
923
- line: 1,
924
- column: 28,
925
- )
926
- expect(tokens[7]).to have_attributes(
927
- type: :DQMID,
928
- value: '/',
929
- line: 1,
930
- column: 29,
931
- )
932
- expect(tokens[8]).to have_attributes(
933
- type: :VARIABLE,
934
- value: 'facts',
935
- line: 1,
936
- column: 33,
937
- )
938
- expect(tokens[9]).to have_attributes(
939
- type: :LBRACK,
940
- value: '[',
941
- line: 1,
942
- column: 38,
943
- )
944
- expect(tokens[10]).to have_attributes(
945
- type: :DQPRE,
946
- value: 'netmask_',
947
- line: 1,
948
- column: 39,
949
- )
950
- expect(tokens[11]).to have_attributes(
951
- type: :VARIABLE,
952
- value: 'iface',
953
- line: 1,
954
- column: 50,
955
- )
956
- expect(tokens[12]).to have_attributes(
957
- type: :DQPOST,
958
- value: '',
959
- line: 1,
960
- column: 55,
961
- )
962
- expect(tokens[13]).to have_attributes(
963
- type: :RBRACK,
964
- value: ']',
965
- line: 1,
966
- column: 57,
967
- )
968
- expect(tokens[14]).to have_attributes(
969
- type: :DQPOST,
970
- value: '',
971
- line: 1,
972
- column: 58,
885
+ expect(tokens).to contain_exactly(
886
+ have_attributes(
887
+ type: :DQPRE,
888
+ value: '',
889
+ line: 1,
890
+ column: 1,
891
+ ),
892
+ have_attributes(
893
+ type: :VARIABLE,
894
+ value: 'facts',
895
+ line: 1,
896
+ column: 4,
897
+ ),
898
+ have_attributes(
899
+ type: :LBRACK,
900
+ value: '[',
901
+ line: 1,
902
+ column: 9,
903
+ ),
904
+ have_attributes(
905
+ type: :DQPRE,
906
+ value: 'network_',
907
+ line: 1,
908
+ column: 10,
909
+ ),
910
+ have_attributes(
911
+ type: :VARIABLE,
912
+ value: 'iface',
913
+ line: 1,
914
+ column: 21,
915
+ ),
916
+ have_attributes(
917
+ type: :DQPOST,
918
+ value: '',
919
+ line: 1,
920
+ column: 26,
921
+ ),
922
+ have_attributes(
923
+ type: :RBRACK,
924
+ value: ']',
925
+ line: 1,
926
+ column: 28,
927
+ ),
928
+ have_attributes(
929
+ type: :DQMID,
930
+ value: '/',
931
+ line: 1,
932
+ column: 29,
933
+ ),
934
+ have_attributes(
935
+ type: :VARIABLE,
936
+ value: 'facts',
937
+ line: 1,
938
+ column: 33,
939
+ ),
940
+ have_attributes(
941
+ type: :LBRACK,
942
+ value: '[',
943
+ line: 1,
944
+ column: 38,
945
+ ),
946
+ have_attributes(
947
+ type: :DQPRE,
948
+ value: 'netmask_',
949
+ line: 1,
950
+ column: 39,
951
+ ),
952
+ have_attributes(
953
+ type: :VARIABLE,
954
+ value: 'iface',
955
+ line: 1,
956
+ column: 50,
957
+ ),
958
+ have_attributes(
959
+ type: :DQPOST,
960
+ value: '',
961
+ line: 1,
962
+ column: 55,
963
+ ),
964
+ have_attributes(
965
+ type: :RBRACK,
966
+ value: ']',
967
+ line: 1,
968
+ column: 57,
969
+ ),
970
+ have_attributes(
971
+ type: :DQPOST,
972
+ value: '',
973
+ line: 1,
974
+ column: 58,
975
+ ),
973
976
  )
974
977
  end
975
978
 
@@ -988,115 +991,115 @@ describe PuppetLint::Lexer do
988
991
  end
989
992
 
990
993
  it 'creates a tokenised string' do
991
- expect(tokens).to have(18).tokens
992
-
993
- expect(tokens[0]).to have_attributes(
994
- type: :DQPRE,
995
- value: '',
996
- line: 1,
997
- column: 1,
998
- )
999
- expect(tokens[1]).to have_attributes(
1000
- type: :VARIABLE,
1001
- value: 'foo',
1002
- line: 1,
1003
- column: 4,
1004
- )
1005
- expect(tokens[2]).to have_attributes(
1006
- type: :DOT,
1007
- value: '.',
1008
- line: 1,
1009
- column: 8,
1010
- )
1011
- expect(tokens[3]).to have_attributes(
1012
- type: :NAME,
1013
- value: 'map',
1014
- line: 1,
1015
- column: 9,
1016
- )
1017
- expect(tokens[4]).to have_attributes(
1018
- type: :WHITESPACE,
1019
- value: ' ',
1020
- line: 1,
1021
- column: 12,
1022
- )
1023
- expect(tokens[5]).to have_attributes(
1024
- type: :PIPE,
1025
- value: '|',
1026
- line: 1,
1027
- column: 13,
1028
- )
1029
- expect(tokens[6]).to have_attributes(
1030
- type: :VARIABLE,
1031
- value: 'bar',
1032
- line: 1,
1033
- column: 14,
1034
- )
1035
- expect(tokens[7]).to have_attributes(
1036
- type: :PIPE,
1037
- value: '|',
1038
- line: 1,
1039
- column: 18,
1040
- )
1041
- expect(tokens[8]).to have_attributes(
1042
- type: :WHITESPACE,
1043
- value: ' ',
1044
- line: 1,
1045
- column: 19,
1046
- )
1047
- expect(tokens[9]).to have_attributes(
1048
- type: :LBRACE,
1049
- value: '{',
1050
- line: 1,
1051
- column: 20,
1052
- )
1053
- expect(tokens[10]).to have_attributes(
1054
- type: :WHITESPACE,
1055
- value: ' ',
1056
- line: 1,
1057
- column: 21,
1058
- )
1059
- expect(tokens[11]).to have_attributes(
1060
- type: :FUNCTION_NAME,
1061
- value: 'something',
1062
- line: 1,
1063
- column: 22,
1064
- )
1065
- expect(tokens[12]).to have_attributes(
1066
- type: :LPAREN,
1067
- value: '(',
1068
- line: 1,
1069
- column: 31,
1070
- )
1071
- expect(tokens[13]).to have_attributes(
1072
- type: :VARIABLE,
1073
- value: 'bar',
1074
- line: 1,
1075
- column: 32,
1076
- )
1077
- expect(tokens[14]).to have_attributes(
1078
- type: :RPAREN,
1079
- value: ')',
1080
- line: 1,
1081
- column: 36,
1082
- )
1083
- expect(tokens[15]).to have_attributes(
1084
- type: :WHITESPACE,
1085
- value: ' ',
1086
- line: 1,
1087
- column: 37,
1088
- )
1089
- expect(tokens[16]).to have_attributes(
1090
- type: :RBRACE,
1091
- value: '}',
1092
- line: 1,
1093
- column: 38,
1094
- )
1095
- expect(tokens[17]).to have_attributes(
1096
- type: :DQPOST,
1097
- value: '',
1098
- line: 1,
1099
- column: 39,
994
+ expect(tokens).to contain_exactly(
995
+ have_attributes(
996
+ type: :DQPRE,
997
+ value: '',
998
+ line: 1,
999
+ column: 1,
1000
+ ),
1001
+ have_attributes(
1002
+ type: :VARIABLE,
1003
+ value: 'foo',
1004
+ line: 1,
1005
+ column: 4,
1006
+ ),
1007
+ have_attributes(
1008
+ type: :DOT,
1009
+ value: '.',
1010
+ line: 1,
1011
+ column: 8,
1012
+ ),
1013
+ have_attributes(
1014
+ type: :NAME,
1015
+ value: 'map',
1016
+ line: 1,
1017
+ column: 9,
1018
+ ),
1019
+ have_attributes(
1020
+ type: :WHITESPACE,
1021
+ value: ' ',
1022
+ line: 1,
1023
+ column: 12,
1024
+ ),
1025
+ have_attributes(
1026
+ type: :PIPE,
1027
+ value: '|',
1028
+ line: 1,
1029
+ column: 13,
1030
+ ),
1031
+ have_attributes(
1032
+ type: :VARIABLE,
1033
+ value: 'bar',
1034
+ line: 1,
1035
+ column: 14,
1036
+ ),
1037
+ have_attributes(
1038
+ type: :PIPE,
1039
+ value: '|',
1040
+ line: 1,
1041
+ column: 18,
1042
+ ),
1043
+ have_attributes(
1044
+ type: :WHITESPACE,
1045
+ value: ' ',
1046
+ line: 1,
1047
+ column: 19,
1048
+ ),
1049
+ have_attributes(
1050
+ type: :LBRACE,
1051
+ value: '{',
1052
+ line: 1,
1053
+ column: 20,
1054
+ ),
1055
+ have_attributes(
1056
+ type: :WHITESPACE,
1057
+ value: ' ',
1058
+ line: 1,
1059
+ column: 21,
1060
+ ),
1061
+ have_attributes(
1062
+ type: :FUNCTION_NAME,
1063
+ value: 'something',
1064
+ line: 1,
1065
+ column: 22,
1066
+ ),
1067
+ have_attributes(
1068
+ type: :LPAREN,
1069
+ value: '(',
1070
+ line: 1,
1071
+ column: 31,
1072
+ ),
1073
+ have_attributes(
1074
+ type: :VARIABLE,
1075
+ value: 'bar',
1076
+ line: 1,
1077
+ column: 32,
1078
+ ),
1079
+ have_attributes(
1080
+ type: :RPAREN,
1081
+ value: ')',
1082
+ line: 1,
1083
+ column: 36,
1084
+ ),
1085
+ have_attributes(
1086
+ type: :WHITESPACE,
1087
+ value: ' ',
1088
+ line: 1,
1089
+ column: 37,
1090
+ ),
1091
+ have_attributes(
1092
+ type: :RBRACE,
1093
+ value: '}',
1094
+ line: 1,
1095
+ column: 38,
1096
+ ),
1097
+ have_attributes(
1098
+ type: :DQPOST,
1099
+ value: '',
1100
+ line: 1,
1101
+ column: 39,
1102
+ ),
1100
1103
  )
1101
1104
  end
1102
1105