summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Giddins <segiddins@segiddins.me>2016-05-23 14:07:37 -0500
committerSamuel Giddins <segiddins@segiddins.me>2016-06-05 21:54:12 -0500
commit9ede16d8c98e1bb9c1e39f95352cd5a0a98191c1 (patch)
tree4d9b032a87563bf2fd748cb76a9fa5852e23ca78
parent1c48ad2d1b77e470d1127c6494c68fdf1b129031 (diff)
downloadbundler-9ede16d8c98e1bb9c1e39f95352cd5a0a98191c1.tar.gz
[Definition] Allow unlocking when removing the ruby version requirement
-rw-r--r--lib/bundler/definition.rb1
-rw-r--r--spec/install/gemfile/ruby_spec.rb18
2 files changed, 19 insertions, 0 deletions
diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb
index 413eedc168..c09383cb04 100644
--- a/lib/bundler/definition.rb
+++ b/lib/bundler/definition.rb
@@ -85,6 +85,7 @@ module Bundler
@unlock[:gems] ||= []
@unlock[:sources] ||= []
+ @unlocking ||= @unlock[:ruby] || (!@locked_ruby_version ^ !@ruby_version)
current_platform = Bundler.rubygems.platforms.map {|p| generic(p) }.compact.last
add_platform(current_platform)
diff --git a/spec/install/gemfile/ruby_spec.rb b/spec/install/gemfile/ruby_spec.rb
index d3536289eb..d8e188ce48 100644
--- a/spec/install/gemfile/ruby_spec.rb
+++ b/spec/install/gemfile/ruby_spec.rb
@@ -22,4 +22,22 @@ describe "ruby requirement" do
expect(exitstatus).to eq(0) if exitstatus
should_be_installed "rack-obama 1.0"
end
+
+ it "allows removing the ruby version requirement" do
+ install_gemfile <<-G
+ source "file://#{gem_repo1}"
+ ruby "~> #{RUBY_VERSION}"
+ gem "rack"
+ G
+
+ expect(lockfile).to include("RUBY VERSION")
+
+ install_gemfile <<-G
+ source "file://#{gem_repo1}"
+ gem "rack"
+ G
+
+ should_be_installed "rack 1.0.0"
+ expect(lockfile).not_to include("RUBY VERSION")
+ end
end