diff --git a/test/lib/clients/software_proposal_test.rb b/test/lib/clients/software_proposal_test.rb index 4c32c85b0..46a75c228 100755 --- a/test/lib/clients/software_proposal_test.rb +++ b/test/lib/clients/software_proposal_test.rb @@ -3,8 +3,39 @@ require_relative "../../test_helper" require "packager/clients/software_proposal" +RSpec.shared_examples "Installation::ProposalClient" do + describe "#description" do + it "contains 3 string keys (or is nil or {})" do + d = subject.description + next if d.nil? + expect(d).to be_a Hash + expect(d["id"]).to be_a String + expect(d["menu_title"]).to be_a String + expect(d["rich_text_title"]).to be_a String + end + end + + describe "#ask_user" do + it "returns a Hash with workflow_sequence" do + r = subject.ask_user({}) + expect(r).to be_a Hash + expect(r["workflow_sequence"]).to be_a Symbol + end + end +end + describe Yast::SoftwareProposalClient do - it "can be constructed" do - expect { subject }.to_not raise_error + before do + allow(Yast::WFM).to receive(:CallFunction).and_return(:next) + end + + include_examples "Installation::ProposalClient" + + describe "#ask_user(mediacheck)" do + it "returns a Hash with workflow_sequence" do + r = subject.ask_user({"chosen_id" => "mediacheck"}) + expect(r).to be_a Hash + expect(r["workflow_sequence"]).to be_a Symbol + end end end