From e7d91d3776b409dce49277b0392d90645f91a316 Mon Sep 17 00:00:00 2001 From: Stefan Schubert Date: Wed, 4 Apr 2018 17:03:02 +0200 Subject: [PATCH] rubocop --- src/lib/installation/inst_confirm.rb | 4 +- test/lib/inst_confirm_test.rb | 81 ++++++++++++++-------------- 2 files changed, 42 insertions(+), 43 deletions(-) diff --git a/src/lib/installation/inst_confirm.rb b/src/lib/installation/inst_confirm.rb index 132ac9872..b4074b12a 100644 --- a/src/lib/installation/inst_confirm.rb +++ b/src/lib/installation/inst_confirm.rb @@ -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 diff --git a/test/lib/inst_confirm_test.rb b/test/lib/inst_confirm_test.rb index 847b41b7b..8475da6a7 100755 --- a/test/lib/inst_confirm_test.rb +++ b/test/lib/inst_confirm_test.rb @@ -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 @@ -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