Skip to content

Commit

Permalink
adapt tests and fix typos
Browse files Browse the repository at this point in the history
  • Loading branch information
jreidinger committed Mar 21, 2016
1 parent 3493760 commit 8a06544
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
6 changes: 4 additions & 2 deletions src/lib/bootloader/proposal_client.rb
Expand Up @@ -48,7 +48,7 @@ def make_proposal(attrs)
return { "raw_proposal" => [_("do not change")] } unless propose_for_update(force_reset)
else
# in installation always propose missing stuff
bl = Bootloader::BootloaderFactory.proposed
bl = ::Bootloader::BootloaderFactory.proposed
bl.propose
end

Expand Down Expand Up @@ -123,7 +123,9 @@ def propose_for_update(force_reset)
# Repropose the type. A regular Reset/Propose is not enough.
# For more details see bnc#872081
Yast::Bootloader.Reset
Yast::Bootloader.Propose
::Bootloader::BootloaderFactory.clear_cache
proposed = ::Bootloader::BootloaderFactory.proposed
proposed.propose
end

true
Expand Down
2 changes: 1 addition & 1 deletion src/modules/BootStorage.rb
Expand Up @@ -103,7 +103,7 @@ def gpt_boot_disk?
# if bootloader do not know its location, then we do not care
return false unless current_bl.respond_to?(:stage1)

targets = current_bl.devices
targets = current_bl.stage1.devices
target_map = Yast::Storage.GetTargetMap
boot_discs = targets.map { |d| Yast::Storage.GetDisk(target_map, d) }
boot_discs.any? { |d| d["label"] == "gpt" }
Expand Down
9 changes: 6 additions & 3 deletions test/bootloader_proposal_client_test.rb
Expand Up @@ -12,6 +12,7 @@
allow(Yast::BootStorage).to receive(:detect_disks)
allow(Yast::BootStorage).to receive(:mbr_disk).and_return("/dev/sda")
allow(Yast::BootStorage).to receive(:BootPartitionDevice).and_return("/dev/sda1")
allow(Yast::Storage).to receive(:GetTargetMap).and_return({})

allow_any_instance_of(::Bootloader::Stage1).to(
receive(:available_locations)
Expand All @@ -22,6 +23,8 @@
)

allow(::Bootloader::UdevMapping).to receive(:to_mountby_device) { |d| d }

Bootloader::BootloaderFactory.clear_cache
end

describe "#description" do
Expand Down Expand Up @@ -120,7 +123,7 @@
end

it "do not check installation errors if install on nfs" do
expect(Yast::BootStorage).to receive(:disk_with_boot_partition).and_return("/dev/nfs")
expect(Yast::BootStorage).to receive(:disk_with_boot_partition).and_return("/dev/nfs").at_least(:once)

expect(subject.make_proposal({})).to_not include("warning")
end
Expand Down Expand Up @@ -157,7 +160,7 @@
it "call bootloader propose in common installation" do
Yast.import "Mode"
allow(Yast::Mode).to receive(:update).and_return(false)
expect(Yast::Bootloader).to receive(:Propose)
expect(Bootloader::BootloaderFactory).to receive(:proposed).and_call_original

subject.make_proposal({})
end
Expand All @@ -169,7 +172,7 @@
expect(subject).to receive("old_bootloader").and_return("grub").twice

expect(Yast::Bootloader).to receive(:Reset).at_least(:once)
expect(Yast::Bootloader).to receive(:Propose)
expect(Bootloader::BootloaderFactory).to receive(:proposed).and_call_original

subject.make_proposal({})
end
Expand Down

0 comments on commit 8a06544

Please sign in to comment.