[前][次][番号順一覧][スレッド一覧]

ruby-changes:73768

From: Benoit <ko1@a...>
Date: Thu, 29 Sep 2022 01:38:47 +0900 (JST)
Subject: [ruby-changes:73768] 5a1ab740fc (master): Update to ruby/mspec@b60306d

https://git.ruby-lang.org/ruby.git/commit/?id=5a1ab740fc

From 5a1ab740fc287df8bf4038f19bd28bbb73e181b6 Mon Sep 17 00:00:00 2001
From: Benoit Daloze <eregontp@g...>
Date: Wed, 28 Sep 2022 18:37:16 +0200
Subject: Update to ruby/mspec@b60306d

---
 spec/mspec/lib/mspec/commands/mkspec.rb | 16 +++-------------
 spec/mspec/lib/mspec/utils/name_map.rb  |  7 ++++++-
 spec/mspec/lib/mspec/utils/script.rb    |  8 +-------
 spec/mspec/spec/commands/mkspec_spec.rb |  2 +-
 spec/mspec/spec/utils/script_spec.rb    |  5 -----
 5 files changed, 11 insertions(+), 27 deletions(-)

diff --git a/spec/mspec/lib/mspec/commands/mkspec.rb b/spec/mspec/lib/mspec/commands/mkspec.rb
index d10cc35d18..a31cb2191c 100755
--- a/spec/mspec/lib/mspec/commands/mkspec.rb
+++ b/spec/mspec/lib/mspec/commands/mkspec.rb
@@ -95,7 +95,9 @@ class MkSpec https://github.com/ruby/ruby/blob/trunk/spec/mspec/lib/mspec/commands/mkspec.rb#L95
 
   def write_spec(file, meth, exists)
     if exists
-      out = `#{ruby} #{MSPEC_HOME}/bin/mspec-run --dry-run --unguarded -fs -e '#{meth}' #{file}`
+      command = "#{RbConfig.ruby} #{MSPEC_HOME}/bin/mspec-run --dry-run --unguarded -fs -e '#{meth}' #{file}"
+      puts "$ #{command}" if $DEBUG
+      out = `#{command}`
       return if out.include?(meth)
     end
 
@@ -133,18 +135,6 @@ EOS https://github.com/ruby/ruby/blob/trunk/spec/mspec/lib/mspec/commands/mkspec.rb#L135
     end
   end
 
-  ##
-  # Determine and return the path of the ruby executable.
-
-  def ruby
-    ruby = File.join(RbConfig::CONFIG['bindir'],
-                     RbConfig::CONFIG['ruby_install_name'])
-
-    ruby.gsub! File::SEPARATOR, File::ALT_SEPARATOR if File::ALT_SEPARATOR
-
-    return ruby
-  end
-
   def self.main
     ENV['MSPEC_RUNNER'] = '1'
 
diff --git a/spec/mspec/lib/mspec/utils/name_map.rb b/spec/mspec/lib/mspec/utils/name_map.rb
index a389b9d1de..bf70e651a2 100644
--- a/spec/mspec/lib/mspec/utils/name_map.rb
+++ b/spec/mspec/lib/mspec/utils/name_map.rb
@@ -51,6 +51,10 @@ class NameMap https://github.com/ruby/ruby/blob/trunk/spec/mspec/lib/mspec/utils/name_map.rb#L51
     SpecVersion
   ]
 
+  ALWAYS_PRIVATE = %w[
+    initialize initialize_copy initialize_clone initialize_dup respond_to_missing?
+  ].map(&:to_sym)
+
   def initialize(filter = false)
     @seen = {}
     @filter = filter
@@ -86,7 +90,8 @@ class NameMap https://github.com/ruby/ruby/blob/trunk/spec/mspec/lib/mspec/utils/name_map.rb#L90
       hash["#{name}."] = ms.sort unless ms.empty?
 
       ms = m.public_instance_methods(false) +
-           m.protected_instance_methods(false)
+           m.protected_instance_methods(false) +
+           (m.private_instance_methods(false) & ALWAYS_PRIVATE)
       ms.map! { |x| x.to_s }
       hash["#{name}#"] = ms.sort unless ms.empty?
 
diff --git a/spec/mspec/lib/mspec/utils/script.rb b/spec/mspec/lib/mspec/utils/script.rb
index dd1603c20a..e86beaab86 100644
--- a/spec/mspec/lib/mspec/utils/script.rb
+++ b/spec/mspec/lib/mspec/utils/script.rb
@@ -84,12 +84,7 @@ class MSpecScript https://github.com/ruby/ruby/blob/trunk/spec/mspec/lib/mspec/utils/script.rb#L84
 
     names.each do |name|
       config[:path].each do |dir|
-        begin
-          file = File.expand_path name, dir
-        rescue ArgumentError
-          # File.expand_path can issue error e.g. if HOME is not available
-          next
-        end
+        file = File.expand_path name, dir
         if @loaded.include?(file)
           return true
         elsif File.exist? file
@@ -288,7 +283,6 @@ class MSpecScript https://github.com/ruby/ruby/blob/trunk/spec/mspec/lib/mspec/utils/script.rb#L283
 
     script = new
     script.load_default
-    script.try_load '~/.mspecrc'
     script.options
     script.signals
     script.register
diff --git a/spec/mspec/spec/commands/mkspec_spec.rb b/spec/mspec/spec/commands/mkspec_spec.rb
index 825add7212..32262723de 100644
--- a/spec/mspec/spec/commands/mkspec_spec.rb
+++ b/spec/mspec/spec/commands/mkspec_spec.rb
@@ -194,7 +194,7 @@ RSpec.describe MkSpec, "#write_spec" do https://github.com/ruby/ruby/blob/trunk/spec/mspec/spec/commands/mkspec_spec.rb#L194
   end
 
   it "checks if specs exist for the method if the spec file exists" do
-    name = Regexp.escape(@script.ruby)
+    name = Regexp.escape(RbConfig.ruby)
     expect(@script).to receive(:`).with(
         %r"#{name} #{MSPEC_HOME}/bin/mspec-run --dry-run --unguarded -fs -e 'Object#inspect' spec/core/tcejbo/inspect_spec.rb")
     @script.write_spec("spec/core/tcejbo/inspect_spec.rb", "Object#inspect", true)
diff --git a/spec/mspec/spec/utils/script_spec.rb b/spec/mspec/spec/utils/script_spec.rb
index d9f6eac9a9..c35bda8b47 100644
--- a/spec/mspec/spec/utils/script_spec.rb
+++ b/spec/mspec/spec/utils/script_spec.rb
@@ -96,11 +96,6 @@ RSpec.describe MSpecScript, ".main" do https://github.com/ruby/ruby/blob/trunk/spec/mspec/spec/utils/script_spec.rb#L96
     MSpecScript.main
   end
 
-  it "attempts to load the '~/.mspecrc' script" do
-    expect(@script).to receive(:try_load).with('~/.mspecrc')
-    MSpecScript.main
-  end
-
   it "calls the #options method on the script" do
     expect(@script).to receive(:options)
     MSpecScript.main
-- 
cgit v1.2.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]