chef 17.8.25 → 17.9.18

Sign up to get free protection for your applications and to get access to all the features.
@@ -87,7 +87,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
87
87
  options default_options
88
88
  action :install
89
89
  end.should_be_updated
90
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
90
+ expect_matching_installed_version("^chef_rpm-1.10-1.#{pkg_arch}$")
91
91
  end
92
92
 
93
93
  it "does not install if the package is installed" do
@@ -104,12 +104,12 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
104
104
  options default_options
105
105
  action :install
106
106
  end.should_be_updated
107
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
107
+ expect_matching_installed_version("^chef_rpm-1.10-1.#{pkg_arch}$")
108
108
  dnf_package "chef_rpm" do
109
109
  options default_options
110
110
  action :install
111
111
  end.should_not_be_updated
112
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
112
+ expect_matching_installed_version("^chef_rpm-1.10-1.#{pkg_arch}$")
113
113
  end
114
114
 
115
115
  it "does not install if the prior version package is installed" do
@@ -118,7 +118,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
118
118
  options default_options
119
119
  action :install
120
120
  end.should_not_be_updated
121
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
121
+ expect_matching_installed_version("^chef_rpm-1.2-1.#{pkg_arch}$")
122
122
  end
123
123
 
124
124
  it "does not install if the i686 package is installed", :intel_64bit do
@@ -128,7 +128,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
128
128
  options default_options
129
129
  action :install
130
130
  end.should_not_be_updated
131
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.i686$")
131
+ expect_matching_installed_version("^chef_rpm-1.10-1.i686$")
132
132
  end
133
133
 
134
134
  it "does not install if the prior version i686 package is installed", :intel_64bit do
@@ -138,7 +138,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
138
138
  options default_options
139
139
  action :install
140
140
  end.should_not_be_updated
141
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.i686$")
141
+ expect_matching_installed_version("^chef_rpm-1.2-1.i686$")
142
142
  end
143
143
  end
144
144
 
@@ -221,7 +221,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
221
221
  version vstring
222
222
  action :install
223
223
  end.should_not_be_updated
224
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
224
+ expect_matching_installed_version("^chef_rpm-1.2-1.#{pkg_arch}$")
225
225
  end
226
226
  end
227
227
 
@@ -233,7 +233,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
233
233
  version vstring
234
234
  action :upgrade
235
235
  end.should_not_be_updated
236
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
236
+ expect_matching_installed_version("^chef_rpm-1.2-1.#{pkg_arch}$")
237
237
  end
238
238
  end
239
239
 
@@ -245,7 +245,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
245
245
  version vstring
246
246
  action :upgrade
247
247
  end.should_be_updated
248
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
248
+ expect_matching_installed_version("^chef_rpm-1.10-1.#{pkg_arch}$")
249
249
  dnf_package "chef_rpm" do
250
250
  options default_options
251
251
  version vstring
@@ -262,7 +262,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
262
262
  options default_options
263
263
  action :install
264
264
  end.should_be_updated
265
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
265
+ expect_matching_installed_version("^chef_rpm-1.10-1.#{pkg_arch}$")
266
266
  dnf_package "chef_rpm-1.10" do
267
267
  options default_options
268
268
  action :install
@@ -275,7 +275,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
275
275
  options default_options
276
276
  action :install
277
277
  end.should_be_updated
278
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
278
+ expect_matching_installed_version("^chef_rpm-1.2-1.#{pkg_arch}$")
279
279
  dnf_package "chef_rpm-1.2" do
280
280
  options default_options
281
281
  action :install
@@ -288,7 +288,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
288
288
  options default_options
289
289
  action :install
290
290
  end.should_be_updated
291
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
291
+ expect_matching_installed_version("^chef_rpm-1.2-1.#{pkg_arch}$")
292
292
  dnf_package "chef_rpm-0:1.2-1.#{pkg_arch}" do
293
293
  options default_options
294
294
  action :install
@@ -301,7 +301,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
301
301
  options default_options
302
302
  action :install
303
303
  end.should_be_updated
304
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
304
+ expect_matching_installed_version("^chef_rpm-1.2-1.#{pkg_arch}$")
305
305
  dnf_package "chef_rpm-1.2-1" do
306
306
  options default_options
307
307
  action :install
@@ -314,7 +314,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
314
314
  options default_options
315
315
  action :install
316
316
  end.should_be_updated
317
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
317
+ expect_matching_installed_version("^chef_rpm-1.10-1.#{pkg_arch}$")
318
318
  dnf_package "chef_rpm-1*" do
319
319
  options default_options
320
320
  action :install
@@ -327,7 +327,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
327
327
  options default_options
328
328
  action :install
329
329
  end.should_be_updated
330
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
330
+ expect_matching_installed_version("^chef_rpm-1.10-1.#{pkg_arch}$")
331
331
  dnf_package "chef_rp*-1*" do
332
332
  options default_options
333
333
  action :install
@@ -340,7 +340,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
340
340
  options default_options
341
341
  action :install
342
342
  end.should_be_updated
343
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}")
343
+ expect_matching_installed_version("^chef_rpm-1.10-1.#{pkg_arch}")
344
344
  dnf_package "chef_rpm-1.10" do
345
345
  options default_options
346
346
  action :install
@@ -353,7 +353,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
353
353
  options default_options
354
354
  action :install
355
355
  end.should_be_updated
356
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
356
+ expect_matching_installed_version("^chef_rpm-1.2-1.#{pkg_arch}$")
357
357
  dnf_package "chef_rpm-1.2" do
358
358
  options default_options
359
359
  action :install
@@ -370,7 +370,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
370
370
  version "1.10"
371
371
  action :install
372
372
  end.should_be_updated
373
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
373
+ expect_matching_installed_version("^chef_rpm-1.10-1.#{pkg_arch}$")
374
374
  dnf_package "chef_rpm" do
375
375
  options default_options
376
376
  version "1.10"
@@ -385,7 +385,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
385
385
  version "1*"
386
386
  action :install
387
387
  end.should_be_updated
388
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
388
+ expect_matching_installed_version("^chef_rpm-1.10-1.#{pkg_arch}$")
389
389
  dnf_package "chef_rpm" do
390
390
  options default_options
391
391
  version "1*"
@@ -400,7 +400,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
400
400
  version "1.10-1"
401
401
  action :install
402
402
  end.should_be_updated
403
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
403
+ expect_matching_installed_version("^chef_rpm-1.10-1.#{pkg_arch}$")
404
404
  dnf_package "chef_rpm" do
405
405
  options default_options
406
406
  version "1.10-1"
@@ -415,7 +415,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
415
415
  version "0:1.10-1"
416
416
  action :install
417
417
  end.should_be_updated
418
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
418
+ expect_matching_installed_version("^chef_rpm-1.10-1.#{pkg_arch}$")
419
419
  dnf_package "chef_rpm" do
420
420
  options default_options
421
421
  version "0:1.10-1"
@@ -430,7 +430,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
430
430
  version "1.10-1*"
431
431
  action :install
432
432
  end.should_be_updated
433
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
433
+ expect_matching_installed_version("^chef_rpm-1.10-1.#{pkg_arch}$")
434
434
  dnf_package "chef_rpm" do
435
435
  options default_options
436
436
  version "1.10-1*"
@@ -445,7 +445,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
445
445
  version "0:1.10-1*"
446
446
  action :install
447
447
  end.should_be_updated
448
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
448
+ expect_matching_installed_version("^chef_rpm-1.10-1.#{pkg_arch}$")
449
449
  dnf_package "chef_rpm" do
450
450
  options default_options
451
451
  version "0:1.10-1*"
@@ -463,7 +463,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
463
463
  version "1.2-1"
464
464
  action :install
465
465
  end.should_be_updated
466
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
466
+ expect_matching_installed_version("^chef_rpm-1.2-1.#{pkg_arch}$")
467
467
  dnf_package "chef_rpm" do
468
468
  options default_options
469
469
  version "1.2-1"
@@ -480,7 +480,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
480
480
  version "1.2-1"
481
481
  action :install
482
482
  end.should_not_be_updated
483
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
483
+ expect_matching_installed_version("^chef_rpm-1.10-1.#{pkg_arch}$")
484
484
  end
485
485
  end
486
486
 
@@ -491,7 +491,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
491
491
  options default_options
492
492
  action :install
493
493
  end.should_be_updated
494
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
494
+ expect_matching_installed_version("^chef_rpm-1.10-1.#{pkg_arch}$")
495
495
  dnf_package "chef_rpm.#{pkg_arch}" do
496
496
  options default_options
497
497
  action :install
@@ -504,7 +504,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
504
504
  options default_options
505
505
  action :install
506
506
  end.should_be_updated
507
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.i686$")
507
+ expect_matching_installed_version("^chef_rpm-1.10-1.i686$")
508
508
  dnf_package "chef_rpm.i686" do
509
509
  options default_options
510
510
  action :install
@@ -518,7 +518,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
518
518
  arch pkg_arch
519
519
  action :install
520
520
  end.should_be_updated
521
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
521
+ expect_matching_installed_version("^chef_rpm-1.10-1.#{pkg_arch}$")
522
522
  dnf_package "chef_rpm" do
523
523
  options default_options
524
524
  arch pkg_arch
@@ -533,7 +533,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
533
533
  arch "i686"
534
534
  action :install
535
535
  end.should_be_updated
536
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.i686$")
536
+ expect_matching_installed_version("^chef_rpm-1.10-1.i686$")
537
537
  dnf_package "chef_rpm" do
538
538
  options default_options
539
539
  arch "i686"
@@ -548,7 +548,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
548
548
  version "1.10-1"
549
549
  action :install
550
550
  end.should_be_updated
551
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.i686$")
551
+ expect_matching_installed_version("^chef_rpm-1.10-1.i686$")
552
552
  dnf_package "chef_rpm.i686" do
553
553
  options default_options
554
554
  version "1.10-1"
@@ -563,7 +563,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
563
563
  version "1.10-1"
564
564
  action :install
565
565
  end.should_be_updated
566
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
566
+ expect_matching_installed_version("^chef_rpm-1.10-1.#{pkg_arch}$")
567
567
  dnf_package "chef_rpm.#{pkg_arch}" do
568
568
  options default_options
569
569
  version "1.10-1"
@@ -579,7 +579,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
579
579
  options default_options
580
580
  action :install
581
581
  end.should_be_updated
582
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
582
+ expect_matching_installed_version("^chef_rpm-1.10-1.#{pkg_arch}$")
583
583
  dnf_package "chef_rpm >= 1.2" do
584
584
  options default_options
585
585
  action :install
@@ -592,7 +592,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
592
592
  options default_options
593
593
  action :install
594
594
  end.should_not_be_updated
595
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
595
+ expect_matching_installed_version("^chef_rpm-1.2-1.#{pkg_arch}$")
596
596
  end
597
597
 
598
598
  it "when it is met, it does nothing" do
@@ -601,7 +601,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
601
601
  options default_options
602
602
  action :install
603
603
  end.should_not_be_updated
604
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
604
+ expect_matching_installed_version("^chef_rpm-1.10-1.#{pkg_arch}$")
605
605
  end
606
606
 
607
607
  it "with nothing installed, it installs the latest version" do
@@ -610,7 +610,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
610
610
  options default_options
611
611
  action :install
612
612
  end.should_be_updated
613
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
613
+ expect_matching_installed_version("^chef_rpm-1.10-1.#{pkg_arch}$")
614
614
  dnf_package "chef_rpm > 1.2" do
615
615
  options default_options
616
616
  action :install
@@ -623,7 +623,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
623
623
  options default_options
624
624
  action :install
625
625
  end.should_be_updated
626
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
626
+ expect_matching_installed_version("^chef_rpm-1.10-1.#{pkg_arch}$")
627
627
  dnf_package "chef_rpm > 1.2" do
628
628
  options default_options
629
629
  action :install
@@ -636,7 +636,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
636
636
  options default_options
637
637
  action :install
638
638
  end.should_be_updated
639
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
639
+ expect_matching_installed_version("^chef_rpm-1.10-1.#{pkg_arch}$")
640
640
  dnf_package "chef_rpm = 1.10" do
641
641
  options default_options
642
642
  action :install
@@ -649,7 +649,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
649
649
  options default_options
650
650
  action :install
651
651
  end.should_not_be_updated
652
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
652
+ expect_matching_installed_version("^chef_rpm-1.2-1.#{pkg_arch}$")
653
653
  end
654
654
 
655
655
  it "when it is met by an installed rpm, it does nothing" do
@@ -658,7 +658,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
658
658
  options default_options
659
659
  action :install
660
660
  end.should_not_be_updated
661
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
661
+ expect_matching_installed_version("^chef_rpm-1.10-1.#{pkg_arch}$")
662
662
  end
663
663
 
664
664
  it "when there is no solution to the contraint" do
@@ -681,7 +681,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
681
681
  options default_options
682
682
  action :install
683
683
  end.should_be_updated
684
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
684
+ expect_matching_installed_version("^chef_rpm-1.2-1.#{pkg_arch}$")
685
685
  dnf_package "chef_rpm < 1.10" do
686
686
  options default_options
687
687
  action :install
@@ -694,7 +694,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
694
694
  options default_options
695
695
  action :install
696
696
  end.should_not_be_updated
697
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
697
+ expect_matching_installed_version("^chef_rpm-1.2-1.#{pkg_arch}$")
698
698
  end
699
699
 
700
700
  it "with a less than constraint, when the install version fails, it should downgrade" do
@@ -703,7 +703,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
703
703
  options default_options
704
704
  action :install
705
705
  end.should_be_updated
706
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
706
+ expect_matching_installed_version("^chef_rpm-1.2-1.#{pkg_arch}$")
707
707
  dnf_package "chef_rpm < 1.10" do
708
708
  options default_options
709
709
  action :install
@@ -737,7 +737,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
737
737
  name "something"
738
738
  action :install
739
739
  end.should_be_updated
740
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
740
+ expect_matching_installed_version("^chef_rpm-1.2-1.#{pkg_arch}$")
741
741
  dnf_package "something" do
742
742
  source("#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm")
743
743
  options default_options
@@ -753,7 +753,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
753
753
  options default_options
754
754
  action :install
755
755
  end.should_be_updated
756
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
756
+ expect_matching_installed_version("^chef_rpm-1.2-1.#{pkg_arch}$")
757
757
  dnf_package "#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm" do
758
758
  options default_options
759
759
  action :install
@@ -767,7 +767,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
767
767
  version "1.2-1"
768
768
  action :install
769
769
  end.should_be_updated
770
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
770
+ expect_matching_installed_version("^chef_rpm-1.2-1.#{pkg_arch}$")
771
771
  dnf_package "#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm" do
772
772
  options default_options
773
773
  version "1.2-1"
@@ -783,7 +783,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
783
783
  version "1.2-1"
784
784
  action :install
785
785
  end.should_not_be_updated
786
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
786
+ expect_matching_installed_version("^chef_rpm-1.10-1.#{pkg_arch}$")
787
787
  end
788
788
 
789
789
  it "does not downgrade the package with :install" do
@@ -792,7 +792,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
792
792
  options default_options
793
793
  action :install
794
794
  end.should_not_be_updated
795
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
795
+ expect_matching_installed_version("^chef_rpm-1.10-1.#{pkg_arch}$")
796
796
  end
797
797
 
798
798
  it "does not upgrade the package with :install" do
@@ -801,7 +801,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
801
801
  options default_options
802
802
  action :install
803
803
  end.should_not_be_updated
804
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
804
+ expect_matching_installed_version("^chef_rpm-1.2-1.#{pkg_arch}$")
805
805
  end
806
806
 
807
807
  it "is idempotent when the package is already installed" do
@@ -810,7 +810,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
810
810
  options default_options
811
811
  action :install
812
812
  end.should_not_be_updated
813
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
813
+ expect_matching_installed_version("^chef_rpm-1.2-1.#{pkg_arch}$")
814
814
  end
815
815
 
816
816
  it "is idempotent when the package is already installed and there is a version string" do
@@ -820,7 +820,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
820
820
  version "1.2-1"
821
821
  action :install
822
822
  end.should_not_be_updated
823
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
823
+ expect_matching_installed_version("^chef_rpm-1.2-1.#{pkg_arch}$")
824
824
  end
825
825
  end
826
826
 
@@ -832,7 +832,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
832
832
  options "--nogpgcheck --disablerepo=*"
833
833
  action :install
834
834
  end.should_not_be_updated
835
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
835
+ expect_matching_installed_version("^chef_rpm-1.2-1.#{pkg_arch}$")
836
836
  end
837
837
 
838
838
  it "works with a local source" do
@@ -842,7 +842,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
842
842
  options "--nogpgcheck --disablerepo=*"
843
843
  action :install
844
844
  end.should_be_updated
845
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
845
+ expect_matching_installed_version("^chef_rpm-1.2-1.#{pkg_arch}$")
846
846
  dnf_package "#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm" do
847
847
  options "--nogpgcheck --disablerepo=*"
848
848
  action :install
@@ -857,8 +857,8 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
857
857
  options default_options
858
858
  action :install
859
859
  end.should_be_updated
860
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match(/^chef_rpm-1.10-1.#{pkg_arch}$/)
861
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match(/^chef_rpm-1.10-1.i686$/)
860
+ expect_matching_installed_version(/^chef_rpm-1.10-1.#{pkg_arch}$/)
861
+ expect_matching_installed_version(/^chef_rpm-1.10-1.i686$/)
862
862
  dnf_package [ "chef_rpm.#{pkg_arch}", "chef_rpm.i686" ] do
863
863
  options default_options
864
864
  action :install
@@ -880,8 +880,8 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
880
880
  options default_options
881
881
  action :install
882
882
  end.should_be_updated
883
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match(/^chef_rpm-1.10-1.#{pkg_arch}$/)
884
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match(/^chef_rpm-1.10-1.i686$/)
883
+ expect_matching_installed_version(/^chef_rpm-1.10-1.#{pkg_arch}$/)
884
+ expect_matching_installed_version(/^chef_rpm-1.10-1.i686$/)
885
885
  dnf_package [ "chef_rpm.#{pkg_arch}", "chef_rpm.i686" ] do
886
886
  options default_options
887
887
  action :install
@@ -894,8 +894,8 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
894
894
  options default_options
895
895
  action :install
896
896
  end.should_be_updated
897
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match(/^chef_rpm-1.10-1.#{pkg_arch}$/)
898
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match(/^chef_rpm-1.10-1.i686$/)
897
+ expect_matching_installed_version(/^chef_rpm-1.10-1.#{pkg_arch}$/)
898
+ expect_matching_installed_version(/^chef_rpm-1.10-1.i686$/)
899
899
  dnf_package [ "chef_rpm.#{pkg_arch}", "chef_rpm.i686" ] do
900
900
  options default_options
901
901
  action :install
@@ -910,8 +910,8 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
910
910
  arch [pkg_arch, "i686"]
911
911
  action :install
912
912
  end.should_be_updated
913
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match(/^chef_rpm-1.10-1.#{pkg_arch}$/)
914
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match(/^chef_rpm-1.10-1.i686$/)
913
+ expect_matching_installed_version(/^chef_rpm-1.10-1.#{pkg_arch}$/)
914
+ expect_matching_installed_version(/^chef_rpm-1.10-1.i686$/)
915
915
  dnf_package %w{chef_rpm chef_rpm} do
916
916
  options default_options
917
917
  arch [pkg_arch, "i686"]
@@ -927,8 +927,8 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
927
927
  arch [pkg_arch, "i686"]
928
928
  action :install
929
929
  end.should_be_updated
930
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match(/^chef_rpm-1.10-1.#{pkg_arch}$/)
931
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match(/^chef_rpm-1.10-1.i686$/)
930
+ expect_matching_installed_version(/^chef_rpm-1.10-1.#{pkg_arch}$/)
931
+ expect_matching_installed_version(/^chef_rpm-1.10-1.i686$/)
932
932
  dnf_package %w{chef_rpm chef_rpm} do
933
933
  options default_options
934
934
  action :install
@@ -943,8 +943,8 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
943
943
  arch [pkg_arch, "i686"]
944
944
  action :install
945
945
  end.should_be_updated
946
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match(/^chef_rpm-1.10-1.#{pkg_arch}$/)
947
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match(/^chef_rpm-1.10-1.i686$/)
946
+ expect_matching_installed_version(/^chef_rpm-1.10-1.#{pkg_arch}$/)
947
+ expect_matching_installed_version(/^chef_rpm-1.10-1.i686$/)
948
948
  dnf_package %w{chef_rpm chef_rpm} do
949
949
  options default_options
950
950
  action :install
@@ -979,7 +979,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
979
979
  options ["--nogpgcheck", "--disablerepo=*", "--enablerepo=chef-dnf-localtesting"]
980
980
  action :install
981
981
  end.should_be_updated
982
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
982
+ expect_matching_installed_version("^chef_rpm-1.10-1.#{pkg_arch}$")
983
983
  dnf_package "chef_rpm" do
984
984
  options ["--nogpgcheck", "--disablerepo=*", "--enablerepo=chef-dnf-localtesting"]
985
985
  action :install
@@ -1000,7 +1000,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
1000
1000
  options "--nogpgcheck --enablerepo=chef-dnf-localtesting"
1001
1001
  action :install
1002
1002
  end.should_be_updated
1003
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
1003
+ expect_matching_installed_version("^chef_rpm-1.10-1.#{pkg_arch}$")
1004
1004
  dnf_package "chef_rpm" do
1005
1005
  options "--nogpgcheck --enablerepo=chef-dnf-localtesting"
1006
1006
  action :install
@@ -1018,14 +1018,14 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
1018
1018
  options "--nogpgcheck --disablerepo=chef-dnf-localtesting"
1019
1019
  action :upgrade
1020
1020
  end.should_not_be_updated
1021
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
1021
+ expect_matching_installed_version("^chef_rpm-1.2-1.#{pkg_arch}$")
1022
1022
  # now we're still using the same cache in the dnf_helper.py cache and we test to see if the
1023
1023
  # repo that we temporarily disabled is enabled on this pass.
1024
1024
  dnf_package "chef_rpm-1.10-1.#{pkg_arch}" do
1025
1025
  options "--nogpgcheck"
1026
1026
  action :install
1027
1027
  end.should_be_updated
1028
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
1028
+ expect_matching_installed_version("^chef_rpm-1.10-1.#{pkg_arch}$")
1029
1029
  dnf_package "chef_rpm-1.10-1.#{pkg_arch}" do
1030
1030
  options "--nogpgcheck"
1031
1031
  action :install
@@ -1036,7 +1036,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
1036
1036
 
1037
1037
  describe ":upgrade" do
1038
1038
  context "downgrades" do
1039
- it "just work with DNF" do
1039
+ it "just works by default" do
1040
1040
  preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
1041
1041
  dnf_package "chef_rpm" do
1042
1042
  options default_options
@@ -1061,7 +1061,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
1061
1061
  source("#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm")
1062
1062
  action :upgrade
1063
1063
  end.should_be_updated
1064
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
1064
+ expect_matching_installed_version("^chef_rpm-1.2-1.#{pkg_arch}$")
1065
1065
  dnf_package "something" do
1066
1066
  options default_options
1067
1067
  package_name "somethingelse"
@@ -1076,7 +1076,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
1076
1076
  options default_options
1077
1077
  action :upgrade
1078
1078
  end.should_be_updated
1079
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
1079
+ expect_matching_installed_version("^chef_rpm-1.2-1.#{pkg_arch}$")
1080
1080
  dnf_package "#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm" do
1081
1081
  options default_options
1082
1082
  action :upgrade
@@ -1089,7 +1089,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
1089
1089
  options default_options
1090
1090
  action :upgrade
1091
1091
  end.should_be_updated
1092
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
1092
+ expect_matching_installed_version("^chef_rpm-1.2-1.#{pkg_arch}$")
1093
1093
  dnf_package "#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm" do
1094
1094
  options default_options
1095
1095
  action :upgrade
@@ -1103,7 +1103,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
1103
1103
  allow_downgrade false
1104
1104
  action :upgrade
1105
1105
  end.should_not_be_updated
1106
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
1106
+ expect_matching_installed_version("^chef_rpm-1.10-1.#{pkg_arch}$")
1107
1107
  end
1108
1108
 
1109
1109
  it "upgrades the package" do
@@ -1112,7 +1112,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
1112
1112
  options default_options
1113
1113
  action :upgrade
1114
1114
  end.should_be_updated
1115
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
1115
+ expect_matching_installed_version("^chef_rpm-1.10-1.#{pkg_arch}$")
1116
1116
  dnf_package "#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.10-1.#{pkg_arch}.rpm" do
1117
1117
  options default_options
1118
1118
  action :upgrade
@@ -1125,7 +1125,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
1125
1125
  options default_options
1126
1126
  action :upgrade
1127
1127
  end.should_not_be_updated
1128
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
1128
+ expect_matching_installed_version("^chef_rpm-1.2-1.#{pkg_arch}$")
1129
1129
  end
1130
1130
  end
1131
1131
 
@@ -1137,7 +1137,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
1137
1137
  options "--nogpgcheck --disablerepo=*"
1138
1138
  action :upgrade
1139
1139
  end.should_not_be_updated
1140
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
1140
+ expect_matching_installed_version("^chef_rpm-1.2-1.#{pkg_arch}$")
1141
1141
  end
1142
1142
 
1143
1143
  it "works with a local source" do
@@ -1147,7 +1147,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
1147
1147
  options "--nogpgcheck --disablerepo=*"
1148
1148
  action :upgrade
1149
1149
  end.should_be_updated
1150
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
1150
+ expect_matching_installed_version("^chef_rpm-1.2-1.#{pkg_arch}$")
1151
1151
  dnf_package "#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm" do
1152
1152
  options default_options
1153
1153
  action :upgrade
@@ -1163,7 +1163,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
1163
1163
  version "1.10-1"
1164
1164
  action :upgrade
1165
1165
  end.should_be_updated
1166
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
1166
+ expect_matching_installed_version("^chef_rpm-1.10-1.#{pkg_arch}$")
1167
1167
  dnf_package "chef_rpm" do
1168
1168
  options default_options
1169
1169
  version "1.10-1"
@@ -1178,7 +1178,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
1178
1178
  version "1.2-1"
1179
1179
  action :upgrade
1180
1180
  end.should_be_updated
1181
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
1181
+ expect_matching_installed_version("^chef_rpm-1.2-1.#{pkg_arch}$")
1182
1182
  dnf_package "chef_rpm" do
1183
1183
  options default_options
1184
1184
  version "1.2-1"
@@ -1193,7 +1193,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
1193
1193
  version "1.10"
1194
1194
  action :upgrade
1195
1195
  end.should_be_updated
1196
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
1196
+ expect_matching_installed_version("^chef_rpm-1.10-1.#{pkg_arch}$")
1197
1197
  dnf_package "chef_rpm" do
1198
1198
  options default_options
1199
1199
  version "1.10"
@@ -1208,7 +1208,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
1208
1208
  version("1.2")
1209
1209
  action :upgrade
1210
1210
  end.should_be_updated
1211
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
1211
+ expect_matching_installed_version("^chef_rpm-1.2-1.#{pkg_arch}$")
1212
1212
  dnf_package "chef_rpm" do
1213
1213
  options default_options
1214
1214
  version("1.2")
@@ -1222,7 +1222,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
1222
1222
  options default_options
1223
1223
  action :upgrade
1224
1224
  end.should_be_updated
1225
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
1225
+ expect_matching_installed_version("^chef_rpm-1.10-1.#{pkg_arch}$")
1226
1226
  dnf_package "chef_rpm-1.10-1" do
1227
1227
  options default_options
1228
1228
  action :upgrade
@@ -1235,7 +1235,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
1235
1235
  options default_options
1236
1236
  action :upgrade
1237
1237
  end.should_be_updated
1238
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
1238
+ expect_matching_installed_version("^chef_rpm-1.2-1.#{pkg_arch}$")
1239
1239
  dnf_package "chef_rpm-1.2-1" do
1240
1240
  options default_options
1241
1241
  action :upgrade
@@ -1248,7 +1248,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
1248
1248
  options default_options
1249
1249
  action :upgrade
1250
1250
  end.should_be_updated
1251
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
1251
+ expect_matching_installed_version("^chef_rpm-1.10-1.#{pkg_arch}$")
1252
1252
  dnf_package "chef_rpm-1.10" do
1253
1253
  options default_options
1254
1254
  action :upgrade
@@ -1261,7 +1261,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
1261
1261
  options default_options
1262
1262
  action :upgrade
1263
1263
  end.should_be_updated
1264
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
1264
+ expect_matching_installed_version("^chef_rpm-1.2-1.#{pkg_arch}$")
1265
1265
  dnf_package "chef_rpm-1.2" do
1266
1266
  options default_options
1267
1267
  action :upgrade
@@ -1274,7 +1274,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
1274
1274
  options default_options
1275
1275
  action :upgrade
1276
1276
  end.should_be_updated
1277
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
1277
+ expect_matching_installed_version("^chef_rpm-1.10-1.#{pkg_arch}$")
1278
1278
  dnf_package "chef_rpm = 1.10" do
1279
1279
  options default_options
1280
1280
  action :upgrade
@@ -1287,7 +1287,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
1287
1287
  options default_options
1288
1288
  action :upgrade
1289
1289
  end.should_be_updated
1290
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
1290
+ expect_matching_installed_version("^chef_rpm-1.2-1.#{pkg_arch}$")
1291
1291
  dnf_package "chef_rpm = 1.2" do
1292
1292
  options default_options
1293
1293
  action :upgrade
@@ -1300,7 +1300,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
1300
1300
  options default_options
1301
1301
  action :upgrade
1302
1302
  end.should_be_updated
1303
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
1303
+ expect_matching_installed_version("^chef_rpm-1.10-1.#{pkg_arch}$")
1304
1304
  dnf_package "chef_rpm > 1.2" do
1305
1305
  options default_options
1306
1306
  action :upgrade
@@ -1313,7 +1313,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
1313
1313
  options default_options
1314
1314
  action :upgrade
1315
1315
  end.should_be_updated
1316
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
1316
+ expect_matching_installed_version("^chef_rpm-1.2-1.#{pkg_arch}$")
1317
1317
  dnf_package "chef_rpm < 1.10" do
1318
1318
  options default_options
1319
1319
  action :upgrade
@@ -1326,7 +1326,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
1326
1326
  options default_options
1327
1327
  action :upgrade
1328
1328
  end.should_not_be_updated
1329
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
1329
+ expect_matching_installed_version("^chef_rpm-1.10-1.#{pkg_arch}$")
1330
1330
  end
1331
1331
 
1332
1332
  it "with a < pin in the name and no rpm installed it installs" do
@@ -1335,7 +1335,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
1335
1335
  options default_options
1336
1336
  action :upgrade
1337
1337
  end.should_not_be_updated
1338
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
1338
+ expect_matching_installed_version("^chef_rpm-1.2-1.#{pkg_arch}$")
1339
1339
  end
1340
1340
 
1341
1341
  it "with a > pin in the name and non-matching rpm installed it upgrades" do
@@ -1344,7 +1344,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
1344
1344
  options default_options
1345
1345
  action :upgrade
1346
1346
  end.should_be_updated
1347
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
1347
+ expect_matching_installed_version("^chef_rpm-1.10-1.#{pkg_arch}$")
1348
1348
  dnf_package "chef_rpm > 1.2" do
1349
1349
  options default_options
1350
1350
  action :upgrade
@@ -1357,7 +1357,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
1357
1357
  options default_options
1358
1358
  action :upgrade
1359
1359
  end.should_be_updated
1360
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
1360
+ expect_matching_installed_version("^chef_rpm-1.2-1.#{pkg_arch}$")
1361
1361
  dnf_package "chef_rpm < 1.10" do
1362
1362
  options default_options
1363
1363
  action :upgrade
@@ -1374,7 +1374,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
1374
1374
  options default_options
1375
1375
  action :remove
1376
1376
  end.should_not_be_updated
1377
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^package chef_rpm is not installed$")
1377
+ expect_matching_installed_version("^package chef_rpm is not installed$")
1378
1378
  end
1379
1379
 
1380
1380
  it "removes the package if the package is installed" do
@@ -1383,7 +1383,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
1383
1383
  options default_options
1384
1384
  action :remove
1385
1385
  end.should_be_updated
1386
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^package chef_rpm is not installed$")
1386
+ expect_matching_installed_version("^package chef_rpm is not installed$")
1387
1387
  end
1388
1388
 
1389
1389
  it "does not remove the package twice" do
@@ -1392,12 +1392,12 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
1392
1392
  options default_options
1393
1393
  action :remove
1394
1394
  end.should_be_updated
1395
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^package chef_rpm is not installed$")
1395
+ expect_matching_installed_version("^package chef_rpm is not installed$")
1396
1396
  dnf_package "chef_rpm" do
1397
1397
  options default_options
1398
1398
  action :remove
1399
1399
  end.should_not_be_updated
1400
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^package chef_rpm is not installed$")
1400
+ expect_matching_installed_version("^package chef_rpm is not installed$")
1401
1401
  end
1402
1402
 
1403
1403
  it "removes the package if the prior version package is installed" do
@@ -1406,7 +1406,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
1406
1406
  options default_options
1407
1407
  action :remove
1408
1408
  end.should_be_updated
1409
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^package chef_rpm is not installed$")
1409
+ expect_matching_installed_version("^package chef_rpm is not installed$")
1410
1410
  dnf_package "chef_rpm" do
1411
1411
  options default_options
1412
1412
  action :remove
@@ -1420,7 +1420,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
1420
1420
  options default_options
1421
1421
  action :remove
1422
1422
  end.should_be_updated
1423
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^package chef_rpm is not installed$")
1423
+ expect_matching_installed_version("^package chef_rpm is not installed$")
1424
1424
  dnf_package "chef_rpm" do
1425
1425
  options default_options
1426
1426
  action :remove
@@ -1434,7 +1434,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
1434
1434
  options default_options
1435
1435
  action :remove
1436
1436
  end.should_be_updated
1437
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^package chef_rpm is not installed$")
1437
+ expect_matching_installed_version("^package chef_rpm is not installed$")
1438
1438
  dnf_package "chef_rpm" do
1439
1439
  options default_options
1440
1440
  action :remove
@@ -1449,7 +1449,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
1449
1449
  options default_options
1450
1450
  action :remove
1451
1451
  end.should_not_be_updated
1452
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^package chef_rpm is not installed$")
1452
+ expect_matching_installed_version("^package chef_rpm is not installed$")
1453
1453
  end
1454
1454
 
1455
1455
  it "removes the package if the package is installed" do
@@ -1458,7 +1458,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
1458
1458
  options default_options
1459
1459
  action :remove
1460
1460
  end.should_be_updated
1461
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^package chef_rpm is not installed$")
1461
+ expect_matching_installed_version("^package chef_rpm is not installed$")
1462
1462
  dnf_package "chef_rpm.#{pkg_arch}" do
1463
1463
  options default_options
1464
1464
  action :remove
@@ -1471,7 +1471,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
1471
1471
  options default_options
1472
1472
  action :remove
1473
1473
  end.should_be_updated
1474
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^package chef_rpm is not installed$")
1474
+ expect_matching_installed_version("^package chef_rpm is not installed$")
1475
1475
  dnf_package "chef_rpm.#{pkg_arch}" do
1476
1476
  options default_options
1477
1477
  action :remove
@@ -1484,7 +1484,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
1484
1484
  options default_options
1485
1485
  action :remove
1486
1486
  end.should_not_be_updated
1487
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.i686$")
1487
+ expect_matching_installed_version("^chef_rpm-1.10-1.i686$")
1488
1488
  end
1489
1489
 
1490
1490
  it "does nothing if the prior version i686 package is installed" do
@@ -1493,7 +1493,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
1493
1493
  options default_options
1494
1494
  action :remove
1495
1495
  end.should_not_be_updated
1496
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.i686$")
1496
+ expect_matching_installed_version("^chef_rpm-1.2-1.i686$")
1497
1497
  end
1498
1498
  end
1499
1499
 
@@ -1504,7 +1504,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
1504
1504
  options default_options
1505
1505
  action :remove
1506
1506
  end.should_be_updated
1507
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
1507
+ expect_matching_installed_version("^chef_rpm-1.10-1.#{pkg_arch}$")
1508
1508
  dnf_package "chef_rpm.i686" do
1509
1509
  options default_options
1510
1510
  action :remove
@@ -1520,7 +1520,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
1520
1520
  options "--nogpgcheck --disablerepo=*"
1521
1521
  action :remove
1522
1522
  end.should_be_updated
1523
- expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^package chef_rpm is not installed$")
1523
+ expect_matching_installed_version("^package chef_rpm is not installed$")
1524
1524
  dnf_package "chef_rpm" do
1525
1525
  options "--nogpgcheck --disablerepo=*"
1526
1526
  action :remove