diff options
| author | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2024-11-15 09:56:53 +0900 |
|---|---|---|
| committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2024-11-15 14:04:19 +0900 |
| commit | bb20083050c47fbc171704d8f4aaa2473e4d743a (patch) | |
| tree | 01f87b020ea05fe02e2d613cd9673ffa7a7a810f | |
| parent | 699e710ad86a9fa3dcc7d80fcc4f71a39e65ddcd (diff) | |
Port test_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 | 21 | ||||
| -rwxr-xr-x | tool/test_for_warn_bundled_gems/test.sh | 4 | ||||
| -rw-r--r-- | tool/test_for_warn_bundled_gems/test_warn_dependency.rb | 11 |
3 files changed, 21 insertions, 15 deletions
diff --git a/spec/bundler/bundled_gems_spec.rb b/spec/bundler/bundled_gems_spec.rb index 90efd28194..f097429c7e 100644 --- a/spec/bundler/bundled_gems_spec.rb +++ b/spec/bundler/bundled_gems_spec.rb @@ -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 diff --git a/tool/test_for_warn_bundled_gems/test.sh b/tool/test_for_warn_bundled_gems/test.sh index 748b5159bd..4997bd0386 100755 --- a/tool/test_for_warn_bundled_gems/test.sh +++ b/tool/test_for_warn_bundled_gems/test.sh @@ -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 diff --git a/tool/test_for_warn_bundled_gems/test_warn_dependency.rb b/tool/test_for_warn_bundled_gems/test_warn_dependency.rb deleted file mode 100644 index 31e416624c..0000000000 --- a/tool/test_for_warn_bundled_gems/test_warn_dependency.rb +++ /dev/null @@ -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" |
