Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@kyanny
Created August 6, 2013 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kyanny/6164775 to your computer and use it in GitHub Desktop.
Save kyanny/6164775 to your computer and use it in GitHub Desktop.
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