Skip to content

Commit 10c26c1

Browse files
committed
correct test cases to properly check result
1 parent 294e6e8 commit 10c26c1

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

spec/unit/puppet/provider/file_line/ruby_spec.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,9 +444,11 @@
444444
:match_for_absence => true,
445445
}
446446
)
447+
@provider = provider_class.new(@resource)
447448
File.open(@tmpfile, 'w') do |fh|
448449
fh.write("foo1\nfoo\nfoo2")
449450
end
451+
expect(@provider.exists?).to eql (true)
450452
@provider.destroy
451453
expect(File.read(@tmpfile)).to eql("foo1\nfoo2")
452454
end
@@ -461,9 +463,11 @@
461463
:match_for_absence => true,
462464
}
463465
)
466+
@provider = provider_class.new(@resource)
464467
File.open(@tmpfile, 'w') do |fh|
465468
fh.write("foo1\nfoo\nfoo2")
466469
end
470+
expect(@provider.exists?).to eql (true)
467471
@provider.destroy
468472
expect(File.read(@tmpfile)).to eql("foo1\nfoo2")
469473
end
@@ -491,6 +495,7 @@
491495
File.open(@tmpfile, 'w') do |fh|
492496
fh.write("foo1\nfoo\nfoo2\nfoo\nfoo")
493497
end
498+
expect(@provider.exists?).to eql (true)
494499
@provider.destroy
495500
expect(File.read(@tmpfile)).to eql("foo1\nfoo2\n")
496501
end
@@ -509,6 +514,7 @@
509514
File.open(@tmpfile, 'w') do |fh|
510515
fh.write("foo1\nfoo\nfoo2")
511516
end
517+
expect(@provider.exists?).to eql (true)
512518
@provider.destroy
513519
expect(File.read(@tmpfile)).to eql("foo1\nfoo\n")
514520
end
@@ -528,6 +534,7 @@
528534
File.open(@tmpfile, 'w') do |fh|
529535
fh.write("foo1\nfoo\nfoo2")
530536
end
537+
expect(@provider.exists?).to eql (true)
531538
@provider.destroy
532539
expect(File.read(@tmpfile)).to eql("foo1\nfoo\n")
533540
end
@@ -547,6 +554,7 @@
547554
File.open(@tmpfile, 'w') do |fh|
548555
fh.write("foo1\nfoo2\nexport HTTP_PROXY=foo\nfoo4\n")
549556
end
557+
expect(@provider.exists?).to eql (true)
550558
@provider.destroy
551559
expect(File.read(@tmpfile)).to eql("foo1\nfoo2\nfoo4\n")
552560
end
@@ -565,6 +573,7 @@
565573
File.open(@tmpfile, 'w') do |fh|
566574
fh.write("foo1\nfoo2\nexport HTTP_PROXY=foo\nfoo4\n")
567575
end
576+
expect(@provider.exists?).to eql (true)
568577
@provider.destroy
569578
expect(File.read(@tmpfile)).to eql("foo1\nfoo2\nfoo4\n")
570579
end

0 commit comments

Comments
 (0)