Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/rubygems/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ def segments # :nodoc:
end

##
# A recommended version for use with a ~> Requirement.
# A recommended version for use with a >= Requirement.

def approximate_recommendation
segments = self.segments
Expand All @@ -334,7 +334,7 @@ def approximate_recommendation
segments.pop while segments.size > 2
segments.push 0 while segments.size < 2

recommendation = "~> #{segments.join(".")}"
recommendation = ">= #{segments.join(".")}"
recommendation += ".a" if prerelease?
recommendation
end
Expand Down
14 changes: 7 additions & 7 deletions test/rubygems/test_gem_version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -165,25 +165,25 @@ def test_spaceship
end

def test_approximate_recommendation
assert_approximate_equal "~> 1.0", "1"
assert_approximate_equal ">= 1.0", "1"
assert_approximate_satisfies_itself "1"

assert_approximate_equal "~> 1.0", "1.0"
assert_approximate_equal ">= 1.0", "1.0"
assert_approximate_satisfies_itself "1.0"

assert_approximate_equal "~> 1.2", "1.2"
assert_approximate_equal ">= 1.2", "1.2"
assert_approximate_satisfies_itself "1.2"

assert_approximate_equal "~> 1.2", "1.2.0"
assert_approximate_equal ">= 1.2", "1.2.0"
assert_approximate_satisfies_itself "1.2.0"

assert_approximate_equal "~> 1.2", "1.2.3"
assert_approximate_equal ">= 1.2", "1.2.3"
assert_approximate_satisfies_itself "1.2.3"

assert_approximate_equal "~> 1.2.a", "1.2.3.a.4"
assert_approximate_equal ">= 1.2.a", "1.2.3.a.4"
assert_approximate_satisfies_itself "1.2.3.a.4"

assert_approximate_equal "~> 1.9.a", "1.9.0.dev"
assert_approximate_equal ">= 1.9.a", "1.9.0.dev"
assert_approximate_satisfies_itself "1.9.0.dev"
end

Expand Down
Loading