Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
require 'minitest/unit'
class GemPessimisticVersionExpander
def expand(version)
"['>= %s', '< %s']" % [version, Gem::Version.create(version).bump]
end
end
class TestGemPessimisticVersionExpander < MiniTest::Unit::TestCase
def setup
@it = GemPessimisticVersionExpander.new
end
def test_expand_minor
assert_equal "['>= 1.2', '< 2']", @it.expand("1.2")
end
def test_expand_patch
assert_equal "['>= 1.24.1', '< 1.25']", @it.expand("1.24.1")
end
end
if __FILE__ == $0
MiniTest::Unit.autorun
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment