FIX: Don't warn on empty .discourse-compatibility (#16032)

This commit is contained in:
Jarek Radosz 2022-02-23 09:44:37 +01:00 committed by GitHub
parent 586d572e05
commit cecfc7ce79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -31,7 +31,7 @@ module Discourse
# 2.4.4.beta6: some-other-branch-ref
# 2.4.2.beta1: v1-tag
def self.find_compatible_resource(version_list, version = ::Discourse::VERSION::STRING)
return unless version_list
return unless version_list.present?
begin
version_list = YAML.safe_load(version_list)

View File

@ -67,6 +67,10 @@ describe Discourse::VERSION do
expect(Discourse.find_compatible_resource(nil)).to be_nil
end
it "returns nil when empty" do
expect(Discourse.find_compatible_resource("")).to be_nil
end
it "raises an error on invalid input" do
expect { Discourse.find_compatible_resource("1.0.0.beta1 12f82d5") }.to raise_error(Discourse::InvalidVersionListError)
end