Skip to content

Commit

Permalink
Mocked BootRecordBackup in unrelated tests.
Browse files Browse the repository at this point in the history
otherwise tests will fail on a system where
/var/lib/YaST2/backup_boot_sectors/
does contain _dev_sda
(because the file exists but the directory is not listable for the
non-root developer)
  • Loading branch information
mvidner committed May 11, 2016
1 parent adcb07b commit d34c153
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test/mbr_update_test.rb
Expand Up @@ -74,6 +74,11 @@ def stage1(devices: [], activate: false, generic_mbr: false)
end

context "activate and generic mbr is disabled" do
before do
allow(::Bootloader::BootRecordBackup)
.to receive(:new).and_return(double(:write => true))
end

it "do not write generic mbr anywhere" do
expect(Yast::Execute).to_not receive(:locally)
expect(Yast::Execute).to_not receive(:on_target)
Expand All @@ -91,6 +96,8 @@ def stage1(devices: [], activate: false, generic_mbr: false)
before do
allow(Yast::Stage).to receive(:initial).and_return(false)
allow(Yast::PackageSystem).to receive(:Install)
allow(::Bootloader::BootRecordBackup)
.to receive(:new).and_return(double(:write => true))
end

it "do nothing if mbr_disk is in Bootloader devices, so we install there bootloader stage1" do
Expand Down Expand Up @@ -142,6 +149,8 @@ def stage1(devices: [], activate: false, generic_mbr: false)
allow(Yast::Stage).to receive(:initial).and_return(false)
allow(Yast::PackageSystem).to receive(:Install)
allow(Yast::Execute).to receive(:locally).and_return("")
allow(::Bootloader::BootRecordBackup)
.to receive(:new).and_return(double(:write => true))
end

context "disk label is DOS mbr" do
Expand Down

0 comments on commit d34c153

Please sign in to comment.