Skip to content

Commit

Permalink
test: ensure older rubygems versions dont fail on semver tests
Browse files Browse the repository at this point in the history
  • Loading branch information
keithamus committed Jun 21, 2017
1 parent 7a77ebe commit fa36ce4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions test/version_sorter_test.rb
Expand Up @@ -21,6 +21,10 @@ def test_sorts_versions_correctly

def test_sorts_versions_like_rubygems
versions = %w(1.0.9.b 1.0.9 1.0.10 2.0 3.1.4.2 1.0.9a 2.0rc2 2.0-rc1)
if (Gem.rubygems_version < Gem::Version.new('2.1.0'))
# Old versions of RubyGems cannot parse semver versions like `2.0-rc1`
versions.pop()
end
sorted_versions = versions.sort_by { |v| Gem::Version.new(v) }

assert_equal sorted_versions, VersionSorter.sort(versions)
Expand Down

0 comments on commit fa36ce4

Please sign in to comment.