From d34c1539ba85a06dfa336e0bac6ef314abc6d65e Mon Sep 17 00:00:00 2001 From: Martin Vidner Date: Wed, 11 May 2016 15:49:55 +0200 Subject: [PATCH] Mocked BootRecordBackup in unrelated tests. 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) --- test/mbr_update_test.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/mbr_update_test.rb b/test/mbr_update_test.rb index 2b57b75a4..1e482b3b0 100644 --- a/test/mbr_update_test.rb +++ b/test/mbr_update_test.rb @@ -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) @@ -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 @@ -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