Ignore empty patch blocks

This commit is contained in:
Rylan Polster 2022-07-15 18:25:57 +02:00
parent f96b9ef535
commit 94138c0848
No known key found for this signature in database
GPG Key ID: 46A744940CFF4D64
2 changed files with 9 additions and 0 deletions

View File

@ -205,6 +205,8 @@ class SoftwareSpec
def patch(strip = :p1, src = nil, &block)
p = Patch.create(strip, src, &block)
return if p.is_a?(ExternalPatch) && p.url.blank?
dependency_collector.add(p.resource) if p.is_a? ExternalPatch
patches << p
end

View File

@ -171,5 +171,12 @@ describe SoftwareSpec do
expect(spec.patches.count).to eq(1)
expect(spec.patches.first.strip).to eq(:p1)
end
it "doesn't add a patch with no url" do
spec.patch do
sha256 "7852a7a365f518b12a1afd763a6a80ece88ac7aeea3c9023aa6c1fe46ac5a1ae"
end
expect(spec.patches.empty?).to be true
end
end
end