diff options
author | David RodrÃguez <deivid.rodriguez@riseup.net> | 2023-12-15 17:02:15 +0100 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2023-12-16 10:04:38 +0800 |
commit | c8e9cd2b8b65e58e48d4ca14203c5a5d08a2d728 (patch) | |
tree | 11c755e9b8f88efa571a0072541a04f9a8e621dd /spec/bundler | |
parent | b8074c2f043d99f6f30ab75ad21cc2c998f49dcf (diff) | |
download | ruby-c8e9cd2b8b65e58e48d4ca14203c5a5d08a2d728.tar.gz |
[rubygems/rubygems] Fix Ruby DSL no longer working as expected
https://github.com/rubygems/rubygems/commit/f6258e5679
Co-authored-by: AndrewSwerlick <andrew.swerlick@gmail.com>
Diffstat (limited to 'spec/bundler')
-rw-r--r-- | spec/bundler/install/gemfile/ruby_spec.rb | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/spec/bundler/install/gemfile/ruby_spec.rb b/spec/bundler/install/gemfile/ruby_spec.rb index 2b88e70928..b64d633fd3 100644 --- a/spec/bundler/install/gemfile/ruby_spec.rb +++ b/spec/bundler/install/gemfile/ruby_spec.rb @@ -120,4 +120,38 @@ RSpec.describe "ruby requirement" do expect(err).to include("There was an error parsing") # i.e. DSL error, not error template end + + it "allows picking up ruby version from a file" do + create_file ".ruby-version", Gem.ruby_version.to_s + + install_gemfile <<-G + source "#{file_uri_for(gem_repo1)}" + ruby file: ".ruby-version" + gem "rack" + G + + expect(lockfile).to include("RUBY VERSION") + end + + it "reads the ruby version file from the right folder when nested Gemfiles are involved" do + create_file ".ruby-version", Gem.ruby_version.to_s + + gemfile <<-G + source "#{file_uri_for(gem_repo1)}" + ruby file: ".ruby-version" + gem "rack" + G + + nested_dir = bundled_app(".ruby-lsp") + + FileUtils.mkdir nested_dir + + create_file ".ruby-lsp/Gemfile", <<-G + eval_gemfile(File.expand_path("../Gemfile", __dir__)) + G + + bundle "install", dir: nested_dir + + expect(bundled_app(".ruby-lsp/Gemfile.lock").read).to include("RUBY VERSION") + end end |