diff options
author | Samuel Giddins <segiddins@segiddins.me> | 2016-06-24 19:55:24 -0500 |
---|---|---|
committer | Samuel Giddins <segiddins@segiddins.me> | 2016-06-24 19:55:24 -0500 |
commit | 95909d1d0eb3d30711876e7517babbcbabe53a1d (patch) | |
tree | b1888010446487094655c8e79ef9856469b53416 | |
parent | bf0a74c5e5d3306a34f8773104e195bfb7dca865 (diff) | |
download | bundler-seg-gemspec-ruby.tar.gz |
Add specs for inferring ruby version from gemspecsseg-gemspec-ruby
-rw-r--r-- | spec/install/gemfile/gemspec_spec.rb | 25 | ||||
-rw-r--r-- | spec/support/helpers.rb | 1 |
2 files changed, 26 insertions, 0 deletions
diff --git a/spec/install/gemfile/gemspec_spec.rb b/spec/install/gemfile/gemspec_spec.rb index a23b3f2cb6..62d13c0bd6 100644 --- a/spec/install/gemfile/gemspec_spec.rb +++ b/spec/install/gemfile/gemspec_spec.rb @@ -143,6 +143,31 @@ describe "bundle install from an existing gemspec" do expect(@err).not_to match(/ahh/) end + context "when the gemspec has a required_ruby_version" do + before do + build_lib "foo", :path => bundled_app do |s| + s.required_ruby_version = ">= 2.0" + end + end + + it "uses the ruby version in the gemspec" do + install_gemfile! <<-G + gemspec + G + run! "puts Bundler.definition.ruby_version" + expect(out).to eq("ruby >= 2.0") + end + + it "prefers the explicit ruby version" do + install_gemfile! <<-G + ruby "< 9999" + gemspec + G + run! "puts Bundler.definition.ruby_version" + expect(out).to eq("ruby < 9999") + end + end + context "when child gemspecs conflict with a released gemspec" do before do # build the "parent" gem that depends on another gem in the same repo diff --git a/spec/support/helpers.rb b/spec/support/helpers.rb index d2a812b3a1..a2bc04d942 100644 --- a/spec/support/helpers.rb +++ b/spec/support/helpers.rb @@ -204,6 +204,7 @@ module Spec opts[:retry] ||= 0 bundle :install, opts end + bang :install_gemfile def lock_gemfile(*args) gemfile(*args) |