Skip to content

Commit

Permalink
[service] Adapt more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
joseivanlopez committed Oct 10, 2023
1 parent 920e9fc commit e2512ec
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
2 changes: 1 addition & 1 deletion service/lib/agama/software/proposal.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def packages_size
#
# @return [Boolean]
def valid?
proposal && !errors?
!(proposal.nil? || errors?)
end

private
Expand Down
22 changes: 10 additions & 12 deletions service/test/agama/software/proposal_test.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

# Copyright (c) [2022] SUSE LLC
# Copyright (c) [2022-2023] SUSE LLC
#
# All Rights Reserved.
#
Expand Down Expand Up @@ -77,9 +77,9 @@
end

context "when no errors were reported" do
it "does not register any error" do
it "does not register any issue" do
subject.calculate
expect(subject.errors).to be_empty
expect(subject.issues).to be_empty
end
end

Expand All @@ -88,10 +88,10 @@
{ "warning_level" => :blocker, "warning" => "Could not install..." }
end

it "registers the corresponding validation error" do
it "registers the corresponding issue" do
subject.calculate
expect(subject.errors).to eq(
[Agama::ValidationError.new("Could not install...")]
expect(subject.issues).to contain_exactly(
an_object_having_attributes({ description: "Could not install..." })
)
end
end
Expand All @@ -100,13 +100,11 @@
let(:last_error) { "Solving errors..." }
let(:solve_errors) { 5 }

it "registers them as validation errors" do
it "registers them as issues" do
subject.calculate
expect(subject.errors).to eq(
[
Agama::ValidationError.new("Solving errors..."),
Agama::ValidationError.new("Found 5 dependency issues.")
]
expect(subject.issues).to contain_exactly(
an_object_having_attributes(description: "Solving errors..."),
an_object_having_attributes(description: "Found 5 dependency issues.")
)
end
end
Expand Down

0 comments on commit e2512ec

Please sign in to comment.