Skip to content

Commit

Permalink
Merge pull request #1266 from yast/transaction_packages
Browse files Browse the repository at this point in the history
fix test for package dialog
  • Loading branch information
jreidinger committed Aug 29, 2022
2 parents b917b7b + 6e6fc5a commit 8a88a96
Showing 1 changed file with 34 additions and 5 deletions.
39 changes: 34 additions & 5 deletions library/packages/test/package_test.rb
Expand Up @@ -25,6 +25,11 @@
describe Yast::Package do
subject { Yast::Package }

before do
# reset cache
subject.instance_variable_set(:@transactional, nil)
end

describe "#CheckAndInstallPackages" do
let(:installed) { false }

Expand Down Expand Up @@ -361,6 +366,35 @@
allow(Yast::Mode).to receive(:commandline).and_return(commandline)
allow(Yast::CommandLine).to receive(:Interactive).and_return(interactive)
allow(Yast::Popup).to receive(:AnyQuestionRichText).and_return(confirm)

allow(Yast::SCR).to receive(:Read).and_return(
[{
"file" => "/",
"freq" => 0,
"mntops" => "rw,relatime",
"passno" => 0,
"spec" => "/dev/nvme0n1p2",
"vfstype" => "ext4"
}]
)
end

context "when run on transactional system" do
it "shows popup and abort" do
allow(Yast::SCR).to receive(:Read).and_return(
[{
"file" => "/",
"freq" => 0,
"mntops" => "ro,relatime",
"passno" => 0,
"spec" => "/dev/nvme0n1p2",
"vfstype" => "ext4"
}]
)

expect(Yast::Popup).to receive(:LongMessage)
expect { subject.PackageDialog(packages, true, nil) }.to raise_error(Yast::AbortException)
end
end

context "when installing packages" do
Expand Down Expand Up @@ -560,11 +594,6 @@
end

describe "#IsTransactionalSystem" do
before do
# reset cache
subject.instance_variable_set(:@transactional, nil)
end

it "returns false if system is not transactional" do
allow(Yast::SCR).to receive(:Read).and_return(
[{
Expand Down

0 comments on commit 8a88a96

Please sign in to comment.