Skip to content

Commit

Permalink
moving some expects statements away from before sections
Browse files Browse the repository at this point in the history
  • Loading branch information
schubi2 committed Apr 11, 2018
1 parent e2ebd69 commit 8f648e9
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions test/addon_product_test.rb
Expand Up @@ -300,27 +300,36 @@
before do
allow(subject).to receive(:AcceptedLicenseAndInfoFile).and_return(true)
allow(Yast::Pkg).to receive(:SourceProductData).with(repo_id)
expect(Yast::Pkg).to receive(:ResolvableInstall).with("available_product",
:product).and_return(true)
expect(Yast::Pkg).to receive(:ResolvableInstall).with("not_available_product",
:product).and_return(false)
allow(subject).to receive(:ReIntegrateFromScratch)
allow(subject).to receive(:Integrate)
expect(subject).to receive(:AddRepo).with(repo["url"], repo["path"], repo["priority"])
allow(subject).to receive(:AddRepo).with(repo["url"], repo["path"], repo["priority"])
.and_return(repo_id)
end

it "adds the repository" do
subject.AddPreselectedAddOnProducts(filelist)
expect(subject.add_on_products).to_not be_empty
end

it "tries to install given products" do
expect(Yast::Pkg).to receive(:ResolvableInstall).with("available_product",
:product).and_return(true)
expect(Yast::Pkg).to receive(:ResolvableInstall).with("not_available_product",
:product).and_return(false)
subject.AddPreselectedAddOnProducts(filelist)
expect(subject.selected_installation_products).to eq(["available_product"])
end

it "reports an error for none existing products" do
expect(Yast::Pkg).to receive(:ResolvableInstall).with("available_product",
:product).and_return(true)
expect(Yast::Pkg).to receive(:ResolvableInstall).with("not_available_product",
:product).and_return(false)
expect(Yast::Report).to receive(:Error)
.with(format(_("Product %s not found on media."), "not_available_product"))
subject.AddPreselectedAddOnProducts(filelist)
end

end

context "when the add-on is on a CD/DVD" do
Expand Down

0 comments on commit 8f648e9

Please sign in to comment.