summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2024-11-15 10:40:40 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2024-11-15 14:04:19 +0900
commit703cffffc9a269c308ad78bec896b7961a01166e (patch)
tree6365649bf4b089da41355cd7bb8a307742d9423b
parent49fde29f77dabef1994b9579b0e6899a38481048 (diff)
Port bundle exec warning check to RSpec example
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/12096
-rw-r--r--spec/bundler/bundled_gems_spec.rb12
-rwxr-xr-xtool/test_for_warn_bundled_gems/test.sh4
-rw-r--r--tool/test_for_warn_bundled_gems/test_warn_bundle_exec.rb1
3 files changed, 12 insertions, 5 deletions
diff --git a/spec/bundler/bundled_gems_spec.rb b/spec/bundler/bundled_gems_spec.rb
index 718c0aa0c3..eee184b82e 100644
--- a/spec/bundler/bundled_gems_spec.rb
+++ b/spec/bundler/bundled_gems_spec.rb
@@ -62,6 +62,18 @@ RSpec.describe "bundled_gems.rb" do
expect(err).to include("You can add net-smtp")
end
+ it "Show warning when bundle exec with ruby and script" do
+ code = <<-RUBY
+ require "ostruct"
+ RUBY
+ create_file("script.rb", code)
+ create_file("Gemfile", "source 'https://rubygems.org'")
+
+ bundle "exec ruby script.rb"
+
+ expect(err).to include(/ostruct was loaded from (.*) from Ruby 3.5.0/)
+ end
+
it "Show warning when warn is not the standard one in the current scope" do
script <<-RUBY
module My
diff --git a/tool/test_for_warn_bundled_gems/test.sh b/tool/test_for_warn_bundled_gems/test.sh
index 20ef45cf74..41b75756d1 100755
--- a/tool/test_for_warn_bundled_gems/test.sh
+++ b/tool/test_for_warn_bundled_gems/test.sh
@@ -4,10 +4,6 @@ echo "* Show warning sub-feature like bigdecimal/util"
ruby test_warn_sub_feature.rb
echo
-echo "* Show warning when bundle exec with ruby and script"
-bundle exec ruby test_warn_bundle_exec.rb
-echo
-
echo "* Show warning when bundle exec with shebang's script"
bundle exec ./test_warn_bundle_exec_shebang.rb
echo
diff --git a/tool/test_for_warn_bundled_gems/test_warn_bundle_exec.rb b/tool/test_for_warn_bundled_gems/test_warn_bundle_exec.rb
deleted file mode 100644
index 30db47ce61..0000000000
--- a/tool/test_for_warn_bundled_gems/test_warn_bundle_exec.rb
+++ /dev/null
@@ -1 +0,0 @@
-require "base64"