Skip to content

Commit

Permalink
fix boot storage tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jreidinger committed Feb 1, 2016
1 parent 026ae1c commit 155c914
Showing 1 changed file with 3 additions and 25 deletions.
28 changes: 3 additions & 25 deletions test/boot_storage_test.rb
Expand Up @@ -169,34 +169,12 @@
expect { subject.detect_disks }.to raise_error
end

it "sets BootCommon.mbrDisk if not already set" do
Yast::BootCommon.mbrDisk = nil

expect(Yast::BootCommon).to receive(:FindMBRDisk).and_return("/dev/vda")
it "sets BootStorage.mbr_disk" do
expect(subject).to receive(:find_mbr_disk).and_return("/dev/vda")

subject.detect_disks

expect(Yast::BootCommon.mbrDisk).to eq "/dev/vda"
end

it "returns :empty if bootloader devices is not yet set" do
allow(Yast::BootCommon).to receive(:GetBootloaderDevices).and_return([])

expect(subject.detect_disks).to eq :empty
end

it "returns :invalid if any bootloader device is no longer available" do
allow(Yast::BootCommon).to receive(:GetBootloaderDevices).and_return(["/dev/not_available"])
allow(Yast::Storage).to receive(:GetDefaultMountBy).and_return(:uuid)

expect(subject.detect_disks).to eq :invalid
end

it "returns :ok if all bootloader devices are available" do
allow(Yast::BootCommon).to receive(:GetBootloaderDevices).and_return(["/dev/vda"])
allow(Yast::Storage).to receive(:GetDefaultMountBy).and_return(:uuid)

expect(subject.detect_disks).to eq :ok
expect(subject.mbr_disk).to eq "/dev/vda"
end
end

Expand Down

0 comments on commit 155c914

Please sign in to comment.