Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Commit

Permalink
Auto merge of #4731 - bundler:seg-ruby-head-specs, r=segiddins
Browse files Browse the repository at this point in the history
[RubyVersion] Fix running when patch < 0
  • Loading branch information
homu committed Jun 28, 2016
2 parents f37fd7f + bc5f881 commit a13baad
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
6 changes: 4 additions & 2 deletions lib/bundler/ruby_version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def to_s(versions = self.versions)
PATTERN = /
ruby\s
([\d.]+) # ruby version
(?:p(\d+))? # optional patchlevel
(?:p(-?\d+))? # optional patchlevel
(?:\s\((\S+)\s(.+)\))? # optional engine info
/xo

Expand Down Expand Up @@ -115,7 +115,9 @@ def self.system
else
raise BundlerError, "RUBY_ENGINE value #{RUBY_ENGINE} is not recognized"
end
@ruby_version ||= RubyVersion.new(ruby_version, RUBY_PATCHLEVEL.to_s, ruby_engine, ruby_engine_version)
patchlevel = RUBY_PATCHLEVEL.to_s

@ruby_version ||= RubyVersion.new(ruby_version, patchlevel, ruby_engine, ruby_engine_version)
end

def to_gem_version_with_patchlevel
Expand Down
8 changes: 4 additions & 4 deletions spec/install/gemspecs_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@
should_be_installed "foo 1.0"
end

it "installs when patch level is specified and the version still matches the current version" do
pending "this feature does not support dev ruby versions" if RUBY_PATCHLEVEL < 0
it "installs when patch level is specified and the version still matches the current version",
:if => RUBY_PATCHLEVEL >= 0 do
build_lib("foo", :path => bundled_app) do |s|
s.required_ruby_version = "#{RUBY_VERSION}.#{RUBY_PATCHLEVEL}"
end
Expand All @@ -73,8 +73,8 @@
should_be_installed "foo 1.0"
end

it "fails and complains about patchlevel on patchlevel mismatch" do
pending "this feature does not support dev ruby versions" if RUBY_PATCHLEVEL < 0
it "fails and complains about patchlevel on patchlevel mismatch",
:if => RUBY_PATCHLEVEL >= 0 do
patchlevel = RUBY_PATCHLEVEL.to_i + 1
build_lib("foo", :path => bundled_app) do |s|
s.required_ruby_version = "#{RUBY_VERSION}.#{patchlevel}"
Expand Down

0 comments on commit a13baad

Please sign in to comment.