summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2024-11-14 17:49:37 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2024-11-15 08:16:03 +0900
commit2d2e5a38bf1fdbd3decc8b459a82b29fb4a4f46a (patch)
tree6e7cfb36ee5e19d7f2af77282c003a7c2ea8edc8
parent1063b5a140370a6c43b0ae19e5abc72d74b68b75 (diff)
Port test_warn_redefined.rb to RSpec example
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/12086
-rw-r--r--spec/bundler/bundled_gems_spec.rb23
-rwxr-xr-xtool/test_for_warn_bundled_gems/test.sh4
-rw-r--r--tool/test_for_warn_bundled_gems/test_warn_redefined.rb21
3 files changed, 23 insertions, 25 deletions
diff --git a/spec/bundler/bundled_gems_spec.rb b/spec/bundler/bundled_gems_spec.rb
index 0beed30244..746a7c695b 100644
--- a/spec/bundler/bundled_gems_spec.rb
+++ b/spec/bundler/bundled_gems_spec.rb
@@ -38,4 +38,27 @@ RSpec.describe "bundled_gems.rb" do
expect(err).to include(/net\/smtp was loaded from (.*) from Ruby 3.1.0/)
expect(err).to include("You can add net-smtp")
end
+
+ it "Show warning when warn is not the standard one in the current scope" do
+ script <<-RUBY
+ module My
+ def warn(msg)
+ end
+
+ def my
+ gemfile do
+ source "https://rubygems.org"
+ end
+
+ require "ostruct"
+ end
+
+ extend self
+ end
+
+ My.my
+ RUBY
+
+ expect(err).to include(/ostruct was loaded from (.*) from Ruby 3.5.0/)
+ end
end
diff --git a/tool/test_for_warn_bundled_gems/test.sh b/tool/test_for_warn_bundled_gems/test.sh
index 33593d1b01..539a2ef8ff 100755
--- a/tool/test_for_warn_bundled_gems/test.sh
+++ b/tool/test_for_warn_bundled_gems/test.sh
@@ -44,10 +44,6 @@ echo "* Don't show warning bigdecimal/util when bigdecimal on Gemfile"
ruby test_no_warn_sub_feature.rb
echo
-echo "* Show warning when warn is not the standard one in the current scope"
-ruby test_warn_redefined.rb
-echo
-
echo "* Show warning with bootsnap and some gem in Gemfile"
ruby test_warn_bootsnap_and_gem.rb
echo
diff --git a/tool/test_for_warn_bundled_gems/test_warn_redefined.rb b/tool/test_for_warn_bundled_gems/test_warn_redefined.rb
deleted file mode 100644
index 3aee2b0991..0000000000
--- a/tool/test_for_warn_bundled_gems/test_warn_redefined.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-require "bundler"
-Bundler::Definition.no_lock = true
-
-module My
- def warn(msg)
- end
-
- def my
- require "bundler/inline"
-
- gemfile do
- source "https://rubygems.org"
- end
-
- require "csv"
- end
-
- extend self
-end
-
-My.my