Skip to content

Commit

Permalink
rubocop
Browse files Browse the repository at this point in the history
  • Loading branch information
schubi2 committed Apr 4, 2018
1 parent f2e6f27 commit e7d91d3
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 43 deletions.
4 changes: 2 additions & 2 deletions src/lib/installation/inst_confirm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ def run(show_license = false)
when :ok
# Check whether the license has been accepted only if required
if show_license &&
license_required? &&
!InstData.product_license_accepted
license_required? &&
!InstData.product_license_accepted

warn_license_required
next
Expand Down
81 changes: 40 additions & 41 deletions test/lib/inst_confirm_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
before do
allow(Yast::Pkg).to receive(:SourceGetCurrent).and_return([])
allow(Yast::ProductLicense).to receive(:info_seen!).with(0)
allow(Yast::Storage).to receive(:GetCommitInfos).and_return([{:destructive => true}])
allow(Yast::Storage).to receive(:GetCommitInfos).and_return([{ :destructive => true }])
end

context "installation mode" do
Expand All @@ -19,53 +19,52 @@
expect(Yast::Label).to receive(:InstallButton)
end

context "no license confirmation UI" do
it "returns true if the user clicks ok" do
expect(Yast::UI).to receive(:UserInput).and_return(:ok)
expect(confirm.run(false)).to eq(true)
end
context "no license confirmation UI" do
it "returns true if the user clicks ok" do
expect(Yast::UI).to receive(:UserInput).and_return(:ok)
expect(confirm.run(false)).to eq(true)
end

it "returns false if the user clicks abort" do
expect(Yast::UI).to receive(:UserInput).and_return(:abort)
expect(confirm.run(false)).to eq(false)
end
end
it "returns false if the user clicks abort" do
expect(Yast::UI).to receive(:UserInput).and_return(:abort)
expect(confirm.run(false)).to eq(false)
end
end

context "license confirmation UI" do
before do
expect(Yast::ProductLicense).to receive(:AcceptanceNeeded).and_return(true)
expect(Yast::ProductLicense).to receive(:ShowLicenseInInstallation).with(
:base_license_rp, 0)
end
context "license confirmation UI" do
before do
expect(Yast::ProductLicense).to receive(:AcceptanceNeeded).and_return(true)
expect(Yast::ProductLicense).to receive(:ShowLicenseIInstallation).with(:base_license_rp,
0)
end

context "user clicks ok" do
before do
expect(Yast::UI).to receive(:UserInput).and_return(:ok)
end
context "user clicks ok" do
before do
expect(Yast::UI).to receive(:UserInput).and_return(:ok)
end

it "returns true if the user has accepted license" do
allow(Yast::InstData).to receive(:product_license_accepted).and_return(true)
expect(confirm.run(true)).to eq(true)
end
end
it "returns true if the user has accepted license" do
allow(Yast::InstData).to receive(:product_license_accepted).and_return(true)
expect(confirm.run(true)).to eq(true)
end
end

context "user clicks abort" do
before do
expect(Yast::UI).to receive(:UserInput).and_return(:abort)
end
context "user clicks abort" do
before do
expect(Yast::UI).to receive(:UserInput).and_return(:abort)
end

it "returns false if the user has not accepted license" do
allow(Yast::InstData).to receive(:product_license_accepted).and_return(false)
expect(confirm.run(true)).to eq(false)
end
it "returns false if the user has not accepted license" do
allow(Yast::InstData).to receive(:product_license_accepted).and_return(false)
expect(confirm.run(true)).to eq(false)
end

it "returns false even if the user has accepted license" do
allow(Yast::InstData).to receive(:product_license_accepted).and_return(true)
expect(confirm.run(true)).to eq(false)
end
end
end

it "returns false even if the user has accepted license" do
allow(Yast::InstData).to receive(:product_license_accepted).and_return(true)
expect(confirm.run(true)).to eq(false)
end
end
end
end

context "update mode" do
Expand Down

0 comments on commit e7d91d3

Please sign in to comment.