Port test_warn_dependency.rb to RSpec example

This commit is contained in:
Hiroshi SHIBATA 2024-11-15 09:56:53 +09:00
Родитель 699e710ad8
Коммит bb20083050
3 изменённых файлов: 21 добавлений и 15 удалений

Просмотреть файл

@ -25,6 +25,27 @@ RSpec.describe "bundled_gems.rb" do
expect(err).to include(/ostruct was loaded from (.*) from Ruby 3.5.0/)
end
it "Show warning when bundled gems called as dependency" do
build_lib "activesupport", "7.0.7.2" do |s|
s.write "lib/active_support/all.rb", "require 'ostruct'"
end
script <<-RUBY, env: { "BUNDLER_SPEC_GEM_REPO" => gem_repo1.to_s }
gemfile do
source "https://gem.repo1"
path "#{lib_path}" do
gem "activesupport", "7.0.7.2"
end
end
require "active_support/all"
RUBY
expect(err).to include(/ostruct was loaded from (.*) from Ruby 3.5.0/)
# TODO: We should assert caller location like below:
# $GEM_HOME/gems/activesupport-7.0.7.2/lib/active_support/core_ext/big_decimal.rb:3: warning: bigdecimal ...
end
it "Show warning dash gem like net/smtp" do
script <<-RUBY
gemfile do

Просмотреть файл

@ -1,9 +1,5 @@
#!/bin/bash
echo "* Show warning when bundled gems called as dependency"
ruby test_warn_dependency.rb
echo
echo "* Show warning sub-feature like bigdecimal/util"
ruby test_warn_sub_feature.rb
echo

Просмотреть файл

@ -1,11 +0,0 @@
require "bundler"
Bundler::Definition.no_lock = true
require "bundler/inline"
gemfile do
source "https://rubygems.org"
gem "activesupport", "7.0.7.2"
end
require "active_support/all"