diff options
| author | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2024-11-15 10:09:36 +0900 |
|---|---|---|
| committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2024-11-15 14:04:19 +0900 |
| commit | 49fde29f77dabef1994b9579b0e6899a38481048 (patch) | |
| tree | 04b6c53c598ea614afcc347e334c72a9b7d2b244 | |
| parent | bb20083050c47fbc171704d8f4aaa2473e4d743a (diff) | |
Port test_no_warn_dependency.rb to RSpec example
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/12096
| -rw-r--r-- | spec/bundler/bundled_gems_spec.rb | 23 | ||||
| -rwxr-xr-x | tool/test_for_warn_bundled_gems/test.sh | 4 | ||||
| -rw-r--r-- | tool/test_for_warn_bundled_gems/test_no_warn_dependency.rb | 13 |
3 files changed, 23 insertions, 17 deletions
diff --git a/spec/bundler/bundled_gems_spec.rb b/spec/bundler/bundled_gems_spec.rb index f097429c7e..718c0aa0c3 100644 --- a/spec/bundler/bundled_gems_spec.rb +++ b/spec/bundler/bundled_gems_spec.rb @@ -85,6 +85,29 @@ 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 + build_lib "ostruct", "1.0.0" do |s| + s.write "lib/ostruct.rb", "puts '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" + gem "ostruct" + end + end + + require "active_support/all" + RUBY + + expect(err).to be_empty + end + it "Don't show warning with net/smtp when net-smtp on Gemfile" do build_lib "net-smtp", "1.0.0" do |s| s.write "lib/net/smtp.rb", "puts 'net-smtp'" diff --git a/tool/test_for_warn_bundled_gems/test.sh b/tool/test_for_warn_bundled_gems/test.sh index 4997bd0386..20ef45cf74 100755 --- a/tool/test_for_warn_bundled_gems/test.sh +++ b/tool/test_for_warn_bundled_gems/test.sh @@ -28,10 +28,6 @@ echo "* Show warning with zeitwerk" ruby test_warn_zeitwerk.rb echo -echo "* Don't show warning bundled gems on Gemfile" -ruby test_no_warn_dependency.rb -echo - echo "* Don't show warning bigdecimal/util when bigdecimal on Gemfile" ruby test_no_warn_sub_feature.rb echo diff --git a/tool/test_for_warn_bundled_gems/test_no_warn_dependency.rb b/tool/test_for_warn_bundled_gems/test_no_warn_dependency.rb deleted file mode 100644 index 11178b5bd1..0000000000 --- a/tool/test_for_warn_bundled_gems/test_no_warn_dependency.rb +++ /dev/null @@ -1,13 +0,0 @@ -require "bundler" -Bundler::Definition.no_lock = true - -require "bundler/inline" - -gemfile do - source "https://rubygems.org" - gem "activesupport", "7.0.7.2" - gem "bigdecimal" - gem "mutex_m" -end - -require "active_support/all" |
