diff options
-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) |