From 5a1ab740fc287df8bf4038f19bd28bbb73e181b6 Mon Sep 17 00:00:00 2001 From: Benoit Daloze 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 +------- 3 files changed, 10 insertions(+), 21 deletions(-) (limited to 'spec/mspec/lib') 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 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 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 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 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 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 script = new script.load_default - script.try_load '~/.mspecrc' script.options script.signals script.register -- cgit v1.2.3