diff --git a/lib/semantic_puppet/version_range.rb b/lib/semantic_puppet/version_range.rb index 73bf722..a7b5bda 100644 --- a/lib/semantic_puppet/version_range.rb +++ b/lib/semantic_puppet/version_range.rb @@ -398,8 +398,8 @@ def upper_bound? # Merge two ranges so that the result matches the intersection of all matching versions. # - # @param range [AbastractRange] the range to intersect with - # @return [AbastractRange,nil] the intersection between the ranges + # @param range [AbstractRange] the range to intersect with + # @return [AbstractRange,nil] the intersection between the ranges # # @api private def intersection(range) @@ -474,7 +474,7 @@ def merge(other) excl_end = other.exclude_end? else max = self.end - excl_end = exclude_end && other.exclude_end? + excl_end = exclude_end? && other.exclude_end? end MinMaxRange.create(excl_begin ? GtRange.new(min) : GtEqRange.new(min), excl_end ? LtRange.new(max) : LtEqRange.new(max)) @@ -499,7 +499,7 @@ def merge(other) # Checks if this matcher accepts a prerelease with the same major, minor, patch triple as the given version. Only matchers # where this has been explicitly stated will respond `true` to this method # - # @return [Boolean] `true` if this matcher accepts a prerelase with the tuple from the given version + # @return [Boolean] `true` if this matcher accepts a prerelease with the tuple from the given version def test_prerelease?(_) false end diff --git a/spec/unit/semantic_puppet/version_range_spec.rb b/spec/unit/semantic_puppet/version_range_spec.rb index 8a49d04..04bfc15 100644 --- a/spec/unit/semantic_puppet/version_range_spec.rb +++ b/spec/unit/semantic_puppet/version_range_spec.rb @@ -270,6 +270,16 @@ def self.test_range(range_list, str, includes, excludes) expect(range.exclude_end?).to be_nil end end + + context 'prerelease' do + test_expressions( + [ '>=5.0.1-rc0' || '>=0.5.0' ] => { + :to_str => '>=5.0.1-rc0', + :includes => ['5.0.1-rc0', '5.0.1'], # should include 1.0.0 + :excludes => ['1.0.0', '5.0.0-rc0', '5.0.2-rc0'] + } + ) + end end context 'invalid expressions' do