Skip to content

Commit

Permalink
Fix disks_order call
Browse files Browse the repository at this point in the history
  • Loading branch information
imobachgs committed Apr 14, 2016
1 parent 1ca1ac5 commit 5b58830
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib/bootloader/grub2.rb
Expand Up @@ -178,7 +178,7 @@ def disk_order_summary
Yast::Builtins.sformat(
# part of summary, %1 is a list of hard disks device names
_("Order of Hard Disks: %1"),
device_map.disks_order(", ")
device_map.disks_order.join(", ")
)
end

Expand Down
29 changes: 29 additions & 0 deletions test/grub2_test.rb
Expand Up @@ -179,6 +179,35 @@
it "contains line saying that bootloader type is GRUB2" do
expect(subject.summary).to include("Boot Loader Type: GRUB2")
end

context "when arch is not s390" do
before do
allow(Yast::Arch).to receive(:s390).and_return(false)
end

it "includes order of hard disks if there are more than 1" do
allow(subject.device_map).to receive(:size).and_return(2)
allow(subject.device_map).to receive(:disks_order).and_return(["/dev/sda", "/dev/sdb"])

expect(subject.summary).to include(%r{Order of Hard Disks: /dev/sda, /dev/sdb})
end

it "does not include order of hard disk if there is only 1" do
allow(subject.device_map).to receive(:size).and_return(1)

expect(subject.summary).to_not include(/Order of Hard Disks/)
end
end

context "when arch is s390" do
before do
allow(Yast::Arch).to receive(:s390).and_return(true)
end

it "does not includes order of hard disks" do
expect(subject.summary).to_not include(/Order of Hard Disks/)
end
end
end

describe "#merge" do
Expand Down

0 comments on commit 5b58830

Please sign in to comment.