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

ruby-changes:52618

From: eregon <ko1@a...>
Date: Tue, 25 Sep 2018 19:40:44 +0900 (JST)
Subject: [ruby-changes:52618] eregon:r64830 (trunk): Update to ruby/mspec@3fb5112

eregon	2018-09-25 19:40:39 +0900 (Tue, 25 Sep 2018)

  New Revision: 64830

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=64830

  Log:
    Update to ruby/mspec@3fb5112

  Modified files:
    trunk/spec/mspec/lib/mspec/commands/mkspec.rb
    trunk/spec/mspec/lib/mspec/guards/conflict.rb
    trunk/spec/mspec/lib/mspec/matchers/raise_error.rb
    trunk/spec/mspec/lib/mspec/utils/name_map.rb
    trunk/spec/mspec/lib/mspec/utils/script.rb
    trunk/spec/mspec/spec/commands/mkspec_spec.rb
    trunk/spec/mspec/spec/guards/conflict_spec.rb
    trunk/spec/mspec/spec/utils/name_map_spec.rb
Index: spec/mspec/spec/utils/name_map_spec.rb
===================================================================
--- spec/mspec/spec/utils/name_map_spec.rb	(revision 64829)
+++ spec/mspec/spec/utils/name_map_spec.rb	(revision 64830)
@@ -129,7 +129,7 @@ describe NameMap, "#file_name" do https://github.com/ruby/ruby/blob/trunk/spec/mspec/spec/utils/name_map_spec.rb#L129
 
   it "returns the name of the spec file based on the special entry for the method" do
     @map.file_name("~", "Regexp").should == "match_spec.rb"
-    @map.file_name("~", "Fixnum").should == "complement_spec.rb"
+    @map.file_name("~", "Integer").should == "complement_spec.rb"
   end
 
   it "returns the name of the spec file based on the default entry for the method" do
@@ -137,7 +137,7 @@ describe NameMap, "#file_name" do https://github.com/ruby/ruby/blob/trunk/spec/mspec/spec/utils/name_map_spec.rb#L137
   end
 
   it "uses the last component of the constant to look up the method name" do
-    @map.file_name("^", "NameMapSpecs::Fixnum").should == "bit_xor_spec.rb"
+    @map.file_name("^", "NameMapSpecs::Integer").should == "bit_xor_spec.rb"
   end
 end
 
Index: spec/mspec/spec/commands/mkspec_spec.rb
===================================================================
--- spec/mspec/spec/commands/mkspec_spec.rb	(revision 64829)
+++ spec/mspec/spec/commands/mkspec_spec.rb	(revision 64830)
@@ -167,13 +167,13 @@ describe MkSpec, "#write_requires" do https://github.com/ruby/ruby/blob/trunk/spec/mspec/spec/commands/mkspec_spec.rb#L167
   end
 
   it "writes the spec_helper require line" do
-    @file.should_receive(:puts).with("require File.expand_path('../../../../spec_helper', __FILE__)")
+    @file.should_receive(:puts).with("require_relative '../../../spec_helper'")
     @script.write_requires("spec/core/tcejbo", "spec/core/tcejbo/inspect_spec.rb")
   end
 
   it "writes require lines for each library specified on the command line" do
     @file.stub(:puts)
-    @file.should_receive(:puts).with("require File.expand_path('../../../../spec_helper', __FILE__)")
+    @file.should_receive(:puts).with("require_relative '../../../spec_helper'")
     @file.should_receive(:puts).with("require 'complex'")
     @script.config[:requires] << 'complex'
     @script.write_requires("spec/core/tcejbo", "spec/core/tcejbo/inspect_spec.rb")
Index: spec/mspec/spec/guards/conflict_spec.rb
===================================================================
--- spec/mspec/spec/guards/conflict_spec.rb	(revision 64829)
+++ spec/mspec/spec/guards/conflict_spec.rb	(revision 64830)
@@ -3,6 +3,7 @@ require 'mspec/guards' https://github.com/ruby/ruby/blob/trunk/spec/mspec/spec/guards/conflict_spec.rb#L3
 
 describe Object, "#conflicts_with" do
   before :each do
+    hide_deprecation_warnings
     ScratchPad.clear
   end
 
@@ -33,6 +34,7 @@ end https://github.com/ruby/ruby/blob/trunk/spec/mspec/spec/guards/conflict_spec.rb#L34
 
 describe Object, "#conflicts_with" do
   before :each do
+    hide_deprecation_warnings
     @guard = ConflictsGuard.new
     ConflictsGuard.stub(:new).and_return(@guard)
   end
Index: spec/mspec/lib/mspec/guards/conflict.rb
===================================================================
--- spec/mspec/lib/mspec/guards/conflict.rb	(revision 64829)
+++ spec/mspec/lib/mspec/guards/conflict.rb	(revision 64830)
@@ -1,6 +1,12 @@ https://github.com/ruby/ruby/blob/trunk/spec/mspec/lib/mspec/guards/conflict.rb#L1
 require 'mspec/guards/guard'
+require 'mspec/utils/deprecate'
 
 class ConflictsGuard < SpecGuard
+  def initialize(*args)
+    MSpec.deprecate 'conflicts_with', 'guard -> { condition } do'
+    super(*args)
+  end
+
   def match?
     # Always convert constants to symbols regardless of version.
     constants = Object.constants.map { |x| x.to_sym }
Index: spec/mspec/lib/mspec/matchers/raise_error.rb
===================================================================
--- spec/mspec/lib/mspec/matchers/raise_error.rb	(revision 64829)
+++ spec/mspec/lib/mspec/matchers/raise_error.rb	(revision 64830)
@@ -1,5 +1,3 @@ https://github.com/ruby/ruby/blob/trunk/spec/mspec/lib/mspec/matchers/raise_error.rb#L1
-require 'mspec/utils/deprecate'
-
 class RaiseErrorMatcher
   def initialize(exception, message, &block)
     @exception = exception
Index: spec/mspec/lib/mspec/utils/script.rb
===================================================================
--- spec/mspec/lib/mspec/utils/script.rb	(revision 64829)
+++ spec/mspec/lib/mspec/utils/script.rb	(revision 64830)
@@ -189,11 +189,7 @@ class MSpecScript https://github.com/ruby/ruby/blob/trunk/spec/mspec/lib/mspec/utils/script.rb#L189
     end
 
     patterns.each do |pattern|
-      begin
-        expanded = File.realpath(pattern)
-      rescue Errno::ENOENT
-        next
-      end
+      expanded = File.expand_path(pattern)
       if File.file?(expanded) && expanded.end_with?('.rb')
         return [expanded]
       elsif File.directory?(expanded)
Index: spec/mspec/lib/mspec/utils/name_map.rb
===================================================================
--- spec/mspec/lib/mspec/utils/name_map.rb	(revision 64829)
+++ spec/mspec/lib/mspec/utils/name_map.rb	(revision 64830)
@@ -8,10 +8,9 @@ class NameMap https://github.com/ruby/ruby/blob/trunk/spec/mspec/lib/mspec/utils/name_map.rb#L8
     '*'   => 'multiply',
     '/'   => 'divide',
     '%'   => 'modulo',
-    '<<'  => {'Bignum' => 'left_shift',
-              'Fixnum' => 'left_shift',
-              'IO'     => 'output',
-              :default => 'append' },
+    '<<'  => {'Integer' => 'left_shift',
+              'IO'      => 'output',
+              :default  => 'append' },
     '>>'  => 'right_shift',
     '<'   => 'lt',
     '<='  => 'lte',
@@ -25,33 +24,22 @@ class NameMap https://github.com/ruby/ruby/blob/trunk/spec/mspec/lib/mspec/utils/name_map.rb#L24
     '[]=' => 'element_set',
     '**'  => 'exponent',
     '!'   => 'not',
-    '~'   => {'Bignum' => 'complement',
-              'Fixnum' => 'complement',
-              'Regexp' => 'match',
-              'String' => 'match' },
+    '~'   => {'Integer' => 'complement',
+              :default  => 'match' },
     '!='  => 'not_equal',
     '!~'  => 'not_match',
     '=~'  => 'match',
-    '&'   => {'Bignum'     => 'bit_and',
-              'Fixnum'     => 'bit_and',
+    '&'   => {'Integer'    => 'bit_and',
               'Array'      => 'intersection',
-              'TrueClass'  => 'and',
-              'FalseClass' => 'and',
-              'NilClass'   => 'and',
-              'Set'        => 'intersection' },
-    '|'   => {'Bignum'     => 'bit_or',
-              'Fixnum'     => 'bit_or',
+              'Set'        => 'intersection',
+              :default     => 'and' },
+    '|'   => {'Integer'    => 'bit_or',
               'Array'      => 'union',
-              'TrueClass'  => 'or',
-              'FalseClass' => 'or',
-              'NilClass'   => 'or',
-              'Set'        => 'union' },
-    '^'   => {'Bignum'     => 'bit_xor',
-              'Fixnum'     => 'bit_xor',
-              'TrueClass'  => 'xor',
-              'FalseClass' => 'xor',
-              'NilClass'   => 'xor',
-              'Set'        => 'exclusion'},
+              'Set'        => 'union',
+              :default     => 'or' },
+    '^'   => {'Integer'    => 'bit_xor',
+              'Set'        => 'exclusion',
+              :default     => 'xor' },
   }
 
   EXCLUDED = %w[
@@ -119,7 +107,12 @@ class NameMap https://github.com/ruby/ruby/blob/trunk/spec/mspec/lib/mspec/utils/name_map.rb#L107
 
   def file_name(m, c)
     if MAP.key?(m)
-      name = MAP[m].is_a?(Hash) ? MAP[m][c.split('::').last] || MAP[m][:default] : MAP[m]
+      mapping = MAP[m]
+      if mapping.is_a?(Hash)
+        name = mapping[c.split('::').last] || mapping.fetch(:default)
+      else
+        name = mapping
+      end
     else
       name = m.gsub(/[?!=]/, '')
     end
Index: spec/mspec/lib/mspec/commands/mkspec.rb
===================================================================
--- spec/mspec/lib/mspec/commands/mkspec.rb	(revision 64829)
+++ spec/mspec/lib/mspec/commands/mkspec.rb	(revision 64830)
@@ -75,7 +75,7 @@ class MkSpec https://github.com/ruby/ruby/blob/trunk/spec/mspec/lib/mspec/commands/mkspec.rb#L75
     parents = '../' * (sub.split('/').length + 1)
 
     File.open(file, 'w') do |f|
-      f.puts "require File.expand_path('../#{parents}spec_helper', __FILE__)"
+      f.puts "require_relative '#{parents}spec_helper'"
       config[:requires].each do |lib|
         f.puts "require '#{lib}'"
       end

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

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