Skip to content

Commit

Permalink
Merge pull request #124 from postmodern/approximate_version_operator
Browse files Browse the repository at this point in the history
Replace usage of the term "spermy" with "approximate".
  • Loading branch information
practicingruby committed Dec 28, 2011
2 parents 550797e + f5035c6 commit cd44ce3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions lib/rubygems/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@
# specify your dependency as ">= 2.0.0" then, you're good, right? What
# happens if fnord 3.0 comes out and it isn't backwards compatible
# with 2.y.z? Your stuff will break as a result of using ">=". The
# better route is to specify your dependency with a "spermy" version
# specifier. They're a tad confusing, so here is how the dependency
# better route is to specify your dependency with an "approximate" version
# specifier ("~>"). They're a tad confusing, so here is how the dependency
# specifiers work:
#
# Specification From ... To (exclusive)
Expand Down Expand Up @@ -277,7 +277,7 @@ def segments # :nodoc:
##
# A recommended version for use with a ~> Requirement.

def spermy_recommendation
def approximate_recommendation
segments = self.segments.dup

segments.pop while segments.any? { |s| String === s }
Expand Down
20 changes: 10 additions & 10 deletions test/rubygems/test_gem_version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,13 @@ def test_spaceship
assert_nil v("1.0") <=> "whatever"
end

def test_spermy_recommendation
assert_spermy_equal "~> 1.0", "1"
assert_spermy_equal "~> 1.0", "1.0"
assert_spermy_equal "~> 1.2", "1.2"
assert_spermy_equal "~> 1.2", "1.2.0"
assert_spermy_equal "~> 1.2", "1.2.3"
assert_spermy_equal "~> 1.2", "1.2.3.a.4"
def test_approximate_recommendation
assert_approximate_equal "~> 1.0", "1"
assert_approximate_equal "~> 1.0", "1.0"
assert_approximate_equal "~> 1.2", "1.2"
assert_approximate_equal "~> 1.2", "1.2.0"
assert_approximate_equal "~> 1.2", "1.2.3"
assert_approximate_equal "~> 1.2", "1.2.3.a.4"
end

def test_to_s
Expand All @@ -125,10 +125,10 @@ def assert_prerelease version
assert v(version).prerelease?, "#{version} is a prerelease"
end

# Assert that +expected+ is the "spermy" recommendation for +version".
# Assert that +expected+ is the "approximate" recommendation for +version".

def assert_spermy_equal expected, version
assert_equal expected, v(version).spermy_recommendation
def assert_approximate_equal expected, version
assert_equal expected, v(version).approximate_recommendation
end

# Assert that bumping the +unbumped+ version yields the +expected+.
Expand Down

0 comments on commit cd44ce3

Please sign in to comment.