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

ruby-changes:47088

From: eregon <ko1@a...>
Date: Thu, 29 Jun 2017 23:35:18 +0900 (JST)
Subject: [ruby-changes:47088] eregon:r59203 (trunk): Update to ruby/mspec@021a119

eregon	2017-06-29 23:35:09 +0900 (Thu, 29 Jun 2017)

  New Revision: 59203

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

  Log:
    Update to ruby/mspec@021a119

  Added files:
    trunk/spec/mspec/spec/fixtures/object_methods_spec.rb
    trunk/spec/mspec/spec/integration/object_methods_spec.rb
  Modified files:
    trunk/spec/mspec/lib/mspec/commands/mspec.rb
    trunk/spec/mspec/lib/mspec/helpers/ruby_exe.rb
    trunk/spec/mspec/lib/mspec/matchers/base.rb
    trunk/spec/mspec/lib/mspec/matchers/be_an_instance_of.rb
    trunk/spec/mspec/lib/mspec/matchers/be_ancestor_of.rb
    trunk/spec/mspec/lib/mspec/matchers/be_close.rb
    trunk/spec/mspec/lib/mspec/matchers/be_computed_by.rb
    trunk/spec/mspec/lib/mspec/matchers/be_empty.rb
    trunk/spec/mspec/lib/mspec/matchers/be_false.rb
    trunk/spec/mspec/lib/mspec/matchers/be_kind_of.rb
    trunk/spec/mspec/lib/mspec/matchers/be_nan.rb
    trunk/spec/mspec/lib/mspec/matchers/be_nil.rb
    trunk/spec/mspec/lib/mspec/matchers/be_true.rb
    trunk/spec/mspec/lib/mspec/matchers/be_true_or_false.rb
    trunk/spec/mspec/lib/mspec/matchers/block_caller.rb
    trunk/spec/mspec/lib/mspec/matchers/complain.rb
    trunk/spec/mspec/lib/mspec/matchers/eql.rb
    trunk/spec/mspec/lib/mspec/matchers/equal.rb
    trunk/spec/mspec/lib/mspec/matchers/equal_element.rb
    trunk/spec/mspec/lib/mspec/matchers/have_class_variable.rb
    trunk/spec/mspec/lib/mspec/matchers/have_constant.rb
    trunk/spec/mspec/lib/mspec/matchers/have_instance_method.rb
    trunk/spec/mspec/lib/mspec/matchers/have_instance_variable.rb
    trunk/spec/mspec/lib/mspec/matchers/have_method.rb
    trunk/spec/mspec/lib/mspec/matchers/have_private_instance_method.rb
    trunk/spec/mspec/lib/mspec/matchers/have_private_method.rb
    trunk/spec/mspec/lib/mspec/matchers/have_protected_instance_method.rb
    trunk/spec/mspec/lib/mspec/matchers/have_public_instance_method.rb
    trunk/spec/mspec/lib/mspec/matchers/have_singleton_method.rb
    trunk/spec/mspec/lib/mspec/matchers/include.rb
    trunk/spec/mspec/lib/mspec/matchers/infinity.rb
    trunk/spec/mspec/lib/mspec/matchers/match_yaml.rb
    trunk/spec/mspec/lib/mspec/matchers/output.rb
    trunk/spec/mspec/lib/mspec/matchers/output_to_fd.rb
    trunk/spec/mspec/lib/mspec/matchers/raise_error.rb
    trunk/spec/mspec/lib/mspec/matchers/respond_to.rb
    trunk/spec/mspec/lib/mspec/matchers/signed_zero.rb
    trunk/spec/mspec/lib/mspec/mocks/mock.rb
    trunk/spec/mspec/lib/mspec/mocks/object.rb
    trunk/spec/mspec/lib/mspec/runner/evaluate.rb
    trunk/spec/mspec/lib/mspec/runner/mspec.rb
    trunk/spec/mspec/lib/mspec/runner/object.rb
    trunk/spec/mspec/lib/mspec/runner/shared.rb
    trunk/spec/mspec/lib/mspec/utils/options.rb
    trunk/spec/mspec/spec/commands/mspec_spec.rb
    trunk/spec/mspec/spec/expectations/should.rb
    trunk/spec/mspec/spec/helpers/ruby_exe_spec.rb
    trunk/spec/mspec/spec/matchers/output_to_fd_spec.rb
    trunk/spec/mspec/spec/mocks/mock_spec.rb
    trunk/spec/mspec/spec/runner/shared_spec.rb
    trunk/spec/mspec/tool/sync/sync-rubyspec.rb
Index: spec/mspec/spec/commands/mspec_spec.rb
===================================================================
--- spec/mspec/spec/commands/mspec_spec.rb	(revision 59202)
+++ spec/mspec/spec/commands/mspec_spec.rb	(revision 59203)
@@ -60,13 +60,13 @@ describe MSpecMain, "#run" do https://github.com/ruby/ruby/blob/trunk/spec/mspec/spec/commands/mspec_spec.rb#L60
   end
 
   it "uses exec to invoke the runner script" do
-    @script.should_receive(:exec).with("ruby", "#{MSPEC_HOME}/bin/mspec-run")
+    @script.should_receive(:exec).with("ruby", "#{MSPEC_HOME}/bin/mspec-run", close_others: false)
     @script.options []
     @script.run
   end
 
   it "shows the command line on stderr" do
-    @script.should_receive(:exec).with("ruby", "#{MSPEC_HOME}/bin/mspec-run")
+    @script.should_receive(:exec).with("ruby", "#{MSPEC_HOME}/bin/mspec-run", close_others: false)
     @script.options []
     @script.run
     $stderr.to_s.should == "$ ruby #{Dir.pwd}/bin/mspec-run\n"
@@ -74,7 +74,7 @@ describe MSpecMain, "#run" do https://github.com/ruby/ruby/blob/trunk/spec/mspec/spec/commands/mspec_spec.rb#L74
 
   it "adds config[:launch] to the exec options" do
     @script.should_receive(:exec).with("ruby",
-        "-Xlaunch.option", "#{MSPEC_HOME}/bin/mspec-run")
+        "-Xlaunch.option", "#{MSPEC_HOME}/bin/mspec-run", close_others: false)
     @config[:launch] << "-Xlaunch.option"
     @script.options []
     @script.run
Index: spec/mspec/spec/helpers/ruby_exe_spec.rb
===================================================================
--- spec/mspec/spec/helpers/ruby_exe_spec.rb	(revision 59202)
+++ spec/mspec/spec/helpers/ruby_exe_spec.rb	(revision 59203)
@@ -11,24 +11,13 @@ class RubyExeSpecs https://github.com/ruby/ruby/blob/trunk/spec/mspec/spec/helpers/ruby_exe_spec.rb#L11
 end
 
 describe "#ruby_exe_options" do
-  before :all do
-    @verbose = $VERBOSE
-    $VERBOSE = nil
-
-    @ruby_engine = Object.const_get :RUBY_ENGINE
+  before :each do
     @ruby_exe_env = ENV['RUBY_EXE']
-
     @script = RubyExeSpecs.new
   end
 
-  after :all do
-    Object.const_set :RUBY_ENGINE, @ruby_engine
+  after :each do
     ENV['RUBY_EXE'] = @ruby_exe_env
-    $VERBOSE = @verbose
-  end
-
-  before :each do
-    @script = RubyExeSpecs.new
   end
 
   it "returns ENV['RUBY_EXE'] when passed :env" do
@@ -37,27 +26,27 @@ describe "#ruby_exe_options" do https://github.com/ruby/ruby/blob/trunk/spec/mspec/spec/helpers/ruby_exe_spec.rb#L26
   end
 
   it "returns 'bin/jruby' when passed :engine and RUBY_ENGINE is 'jruby'" do
-    Object.const_set :RUBY_ENGINE, 'jruby'
+    stub_const "RUBY_ENGINE", 'jruby'
     @script.ruby_exe_options(:engine).should == 'bin/jruby'
   end
 
   it "returns 'bin/rbx' when passed :engine, RUBY_ENGINE is 'rbx'" do
-    Object.const_set :RUBY_ENGINE, 'rbx'
+    stub_const "RUBY_ENGINE", 'rbx'
     @script.ruby_exe_options(:engine).should == 'bin/rbx'
   end
 
   it "returns 'ir' when passed :engine and RUBY_ENGINE is 'ironruby'" do
-    Object.const_set :RUBY_ENGINE, 'ironruby'
+    stub_const "RUBY_ENGINE", 'ironruby'
     @script.ruby_exe_options(:engine).should == 'ir'
   end
 
   it "returns 'maglev-ruby' when passed :engine and RUBY_ENGINE is 'maglev'" do
-    Object.const_set :RUBY_ENGINE, 'maglev'
+    stub_const "RUBY_ENGINE", 'maglev'
     @script.ruby_exe_options(:engine).should == 'maglev-ruby'
   end
 
   it "returns 'topaz' when passed :engine and RUBY_ENGINE is 'topaz'" do
-    Object.const_set :RUBY_ENGINE, 'topaz'
+    stub_const "RUBY_ENGINE", 'topaz'
     @script.ruby_exe_options(:engine).should == 'topaz'
   end
 
@@ -75,21 +64,11 @@ describe "#ruby_exe_options" do https://github.com/ruby/ruby/blob/trunk/spec/mspec/spec/helpers/ruby_exe_spec.rb#L64
 end
 
 describe "#resolve_ruby_exe" do
-  before :all do
-    @verbose = $VERBOSE
-    $VERBOSE = nil
-
-    @name = "ruby_spec_exe"
-  end
-
   before :each do
+    @name = "ruby_spec_exe"
     @script = RubyExeSpecs.new
   end
 
-  after :all do
-    $VERBOSE = @verbose
-  end
-
   it "returns the value returned by #ruby_exe_options if it exists and is executable" do
     @script.should_receive(:ruby_exe_options).and_return(@name)
     File.should_receive(:file?).with(@name).and_return(true)
@@ -126,12 +105,8 @@ describe "#resolve_ruby_exe" do https://github.com/ruby/ruby/blob/trunk/spec/mspec/spec/helpers/ruby_exe_spec.rb#L105
 end
 
 describe Object, "#ruby_cmd" do
-  before :all do
-    @verbose = $VERBOSE
-    $VERBOSE = nil
-
-    @ruby_exe = Object.const_get :RUBY_EXE
-    Object.const_set :RUBY_EXE, 'ruby_spec_exe -w -Q'
+  before :each do
+    stub_const 'RUBY_EXE', 'ruby_spec_exe -w -Q'
 
     @file = "some/ruby/file.rb"
     @code = %(some "real" 'ruby' code)
@@ -139,11 +114,6 @@ describe Object, "#ruby_cmd" do https://github.com/ruby/ruby/blob/trunk/spec/mspec/spec/helpers/ruby_exe_spec.rb#L114
     @script = RubyExeSpecs.new
   end
 
-  after :all do
-    Object.const_set :RUBY_EXE, @ruby_exe
-    $VERBOSE = @verbose
-  end
-
   it "returns a command that runs the given file if it is a file that exists" do
     File.should_receive(:exist?).with(@file).and_return(true)
     @script.ruby_cmd(@file).should == "ruby_spec_exe -w -Q some/ruby/file.rb"
@@ -168,12 +138,15 @@ describe Object, "#ruby_cmd" do https://github.com/ruby/ruby/blob/trunk/spec/mspec/spec/helpers/ruby_exe_spec.rb#L138
 end
 
 describe Object, "#ruby_exe" do
-  before :all do
+  before :each do
+    stub_const 'RUBY_EXE', 'ruby_spec_exe -w -Q'
+
     @script = RubyExeSpecs.new
+    @script.stub(:`)
   end
 
-  before :each do
-    @script.stub(:`)
+  it "returns an Array containing the interpreter executable and flags when given no arguments" do
+    @script.ruby_exe.should == ['ruby_spec_exe', '-w', '-Q']
   end
 
   it "executes (using `) the result of calling #ruby_cmd with the given arguments" do
Index: spec/mspec/spec/integration/object_methods_spec.rb
===================================================================
--- spec/mspec/spec/integration/object_methods_spec.rb	(nonexistent)
+++ spec/mspec/spec/integration/object_methods_spec.rb	(revision 59203)
@@ -0,0 +1,18 @@ https://github.com/ruby/ruby/blob/trunk/spec/mspec/spec/integration/object_methods_spec.rb#L1
+require 'spec_helper'
+
+expected_output = <<EOS
+RUBY_DESCRIPTION
+.
+
+Finished in D.DDDDDD seconds
+
+1 file, 1 example, 1 expectation, 0 failures, 0 errors, 0 tagged
+EOS
+
+describe "MSpec" do
+  it "does not define public methods on Object" do
+    out, ret = run_mspec("run", "spec/fixtures/object_methods_spec.rb")
+    out.should == expected_output
+    ret.success?.should == true
+  end
+end
Index: spec/mspec/spec/expectations/should.rb
===================================================================
--- spec/mspec/spec/expectations/should.rb	(revision 59202)
+++ spec/mspec/spec/expectations/should.rb	(revision 59203)
@@ -33,6 +33,7 @@ MSpec.register :finish, monitor https://github.com/ruby/ruby/blob/trunk/spec/mspec/spec/expectations/should.rb#L33
 at_exit { MSpec.actions :finish }
 
 MSpec.actions :start
+MSpec.setup_env
 
 # Specs
 describe "MSpec expectation method #should" do
Index: spec/mspec/spec/matchers/output_to_fd_spec.rb
===================================================================
--- spec/mspec/spec/matchers/output_to_fd_spec.rb	(revision 59202)
+++ spec/mspec/spec/matchers/output_to_fd_spec.rb	(revision 59203)
@@ -5,38 +5,40 @@ require 'mspec/matchers' https://github.com/ruby/ruby/blob/trunk/spec/mspec/spec/matchers/output_to_fd_spec.rb#L5
 describe OutputToFDMatcher do
   # Figure out how in the hell to achieve this
   it "matches when running the block produces the expected output to the given FD" do
-    output_to_fd("Hi\n", STDERR).matches?(lambda { $stderr.print "Hi\n" }).should == true
+    OutputToFDMatcher.new("Hi\n", STDERR).matches?(lambda { $stderr.print "Hi\n" }).should == true
   end
 
   it "does not match if running the block does not produce the expected output to the FD" do
-    output_to_fd("Hi\n", STDERR).matches?(lambda { $stderr.puts("Hello\n") }).should == false
+    OutputToFDMatcher.new("Hi\n", STDERR).matches?(lambda { $stderr.puts("Hello\n") }).should == false
   end
 
   it "propagate the exception if one is thrown while matching" do
     exc = RuntimeError.new("propagates")
     lambda {
-      output_to_fd("Hi\n", STDERR).matches?(lambda {
+      OutputToFDMatcher.new("Hi\n", STDERR).matches?(lambda {
         raise exc
       }).should == false
     }.should raise_error(exc)
   end
 
   it "defaults to matching against STDOUT" do
-    output_to_fd("Hi\n").matches?(lambda { $stdout.print "Hi\n" }).should == true
+    object = Object.new
+    object.extend MSpecMatchers
+    object.send(:output_to_fd, "Hi\n").matches?(lambda { $stdout.print "Hi\n" }).should == true
   end
 
   it "accepts any IO instance" do
     io = IO.new STDOUT.fileno
-    output_to_fd("Hi\n", io).matches?(lambda { io.print "Hi\n" }).should == true
+    OutputToFDMatcher.new("Hi\n", io).matches?(lambda { io.print "Hi\n" }).should == true
   end
 
   it "allows matching with a Regexp" do
     s = "Hi there\n"
-    output_to_fd(/Hi/, STDERR).matches?(lambda { $stderr.print s }).should == true
-    output_to_fd(/Hi?/, STDERR).matches?(lambda { $stderr.print s }).should == true
-    output_to_fd(/[hH]i?/, STDERR).matches?(lambda { $stderr.print s }).should == true
-    output_to_fd(/.*/, STDERR).matches?(lambda { $stderr.print s }).should == true
-    output_to_fd(/H.*?here/, STDERR).matches?(lambda { $stderr.print s }).should == true
-    output_to_fd(/Ahoy/, STDERR).matches?(lambda { $stderr.print s }).should == false
+    OutputToFDMatcher.new(/Hi/, STDERR).matches?(lambda { $stderr.print s }).should == true
+    OutputToFDMatcher.new(/Hi?/, STDERR).matches?(lambda { $stderr.print s }).should == true
+    OutputToFDMatcher.new(/[hH]i?/, STDERR).matches?(lambda { $stderr.print s }).should == true
+    OutputToFDMatcher.new(/.*/, STDERR).matches?(lambda { $stderr.print s }).should == true
+    OutputToFDMatcher.new(/H.*?here/, STDERR).matches?(lambda { $stderr.print s }).should == true
+    OutputToFDMatcher.new(/Ahoy/, STDERR).matches?(lambda { $stderr.print s }).should == false
   end
 end
Index: spec/mspec/spec/fixtures/object_methods_spec.rb
===================================================================
--- spec/mspec/spec/fixtures/object_methods_spec.rb	(nonexistent)
+++ spec/mspec/spec/fixtures/object_methods_spec.rb	(revision 59203)
@@ -0,0 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/spec/mspec/spec/fixtures/object_methods_spec.rb#L1
+unless defined?(RSpec)
+  describe "Object" do
+    it ".public_instance_methods(false) is empty" do
+      Object.public_instance_methods(false).sort.should ==
+        [:should, :should_not, :should_not_receive, :should_receive, :stub!]
+    end
+  end
+end
Index: spec/mspec/spec/runner/shared_spec.rb
===================================================================
--- spec/mspec/spec/runner/shared_spec.rb	(revision 59202)
+++ spec/mspec/spec/runner/shared_spec.rb	(revision 59203)
@@ -11,6 +11,7 @@ describe Object, "#it_behaves_like" do https://github.com/ruby/ruby/blob/trunk/spec/mspec/spec/runner/shared_spec.rb#L11
 
     @state = ContextState.new "Top level"
     @state.instance_variable_set :@parsed, true
+    @state.singleton_class.send(:public, :it_behaves_like)
 
     @shared = ContextState.new :shared_spec, :shared => true
     MSpec.stub(:retrieve_shared).and_return(@shared)
@@ -51,6 +52,7 @@ describe Object, "#it_behaves_like" do https://github.com/ruby/ruby/blob/trunk/spec/mspec/spec/runner/shared_spec.rb#L52
 
       @state2 = ContextState.new "Second top level"
       @state2.instance_variable_set :@parsed, true
+      @state2.singleton_class.send(:public, :it_behaves_like)
     end
 
     it "ensures the shared spec state is distinct" do
Index: spec/mspec/spec/mocks/mock_spec.rb
===================================================================
--- spec/mspec/spec/mocks/mock_spec.rb	(revision 59202)
+++ spec/mspec/spec/mocks/mock_spec.rb	(revision 59203)
@@ -22,16 +22,14 @@ end https://github.com/ruby/ruby/blob/trunk/spec/mspec/spec/mocks/mock_spec.rb#L22
 describe Mock, ".replaced_name" do
   it "returns the name for a method that is being replaced by a mock method" do
     m = double('a fake id')
-    m.stub(:__mspec_object_id__).and_return(42)
-    Mock.replaced_name(m, :method_call).should == :__mspec_42_method_call__
+    Mock.replaced_name(m, :method_call).should == :"__mspec_#{m.object_id}_method_call__"
   end
 end
 
 describe Mock, ".replaced_key" do
   it "returns a key used internally by Mock" do
     m = double('a fake id')
-    m.stub(:__mspec_object_id__).and_return(42)
-    Mock.replaced_key(m, :method_call).should == [:__mspec_42_method_call__, :method_call]
+    Mock.replaced_key(m, :method_call).should == [:"__mspec_#{m.object_id}_method_call__", :method_call]
   end
 end
 
Index: spec/mspec/tool/sync/sync-rubyspec.rb
===================================================================
--- spec/mspec/tool/sync/sync-rubyspec.rb	(revision 59202)
+++ spec/mspec/tool/sync/sync-rubyspec.rb	(revision 59203)
@@ -18,10 +18,17 @@ IMPLS = { https://github.com/ruby/ruby/blob/trunk/spec/mspec/tool/sync/sync-rubyspec.rb#L18
   },
 }
 
+MSPEC = ARGV.delete('--mspec')
+
 # Assuming the rubyspec repo is a sibling of the mspec repo
 RUBYSPEC_REPO = File.expand_path("../../../../rubyspec", __FILE__)
 raise RUBYSPEC_REPO unless Dir.exist?(RUBYSPEC_REPO)
 
+MSPEC_REPO = File.expand_path("../../../../mspec", __FILE__)
+raise MSPEC_REPO if MSPEC && !Dir.exist?(MSPEC_REPO)
+
+SOURCE_REPO = MSPEC ? MSPEC_REPO : RUBYSPEC_REPO
+
 NOW = Time.now
 
 BRIGHT_YELLOW = "\e[33;1m"
@@ -57,10 +64,13 @@ class RubyImplementation https://github.com/ruby/ruby/blob/trunk/spec/mspec/tool/sync/sync-rubyspec.rb#L64
   end
 
   def last_merge_message
-    @data[:merge_message] || "Merge ruby/spec commit"
+    message = @data[:merge_message] || "Merge ruby/spec commit"
+    message.gsub!("ruby/spec", "ruby/mspec") if MSPEC
+    message
   end
 
   def prefix
+    return "spec/mspec" if MSPEC
     @data[:prefix] || "spec/ruby"
   end
 
@@ -96,18 +106,18 @@ end https://github.com/ruby/ruby/blob/trunk/spec/mspec/tool/sync/sync-rubyspec.rb#L106
 def filter_commits(impl)
   Dir.chdir(impl.repo_name) do
     date = NOW.strftime("%F")
-    branch = "specs-#{date}"
+    branch = "#{MSPEC ? :mspec : :specs}-#{date}"
 
     unless branch?(branch)
       sh "git", "checkout", "-b", branch
       sh "git", "filter-branch", "-f", "--subdirectory-filter", impl.prefix, *impl.from_commit
-      sh "git", "push", "-f", RUBYSPEC_REPO, "#{branch}:#{impl.name}"
+      sh "git", "push", "-f", SOURCE_REPO, "#{branch}:#{impl.name}"
     end
   end
 end
 
 def rebase_commits(impl)
-  Dir.chdir(RUBYSPEC_REPO) do
+  Dir.chdir(SOURCE_REPO) do
     sh "git", "checkout", "master"
     sh "git", "pull"
 
@@ -144,25 +154,29 @@ end https://github.com/ruby/ruby/blob/trunk/spec/mspec/tool/sync/sync-rubyspec.rb#L154
 
 def test_new_specs
   require "yaml"
-  Dir.chdir(RUBYSPEC_REPO) do
-    versions = YAML.load_file(".travis.yml")
-    versions = versions["matrix"]["include"].map { |job| job["rvm"] }
-    versions.delete "ruby-head"
-    min_version, max_version = versions.minmax
-
-    run_rubyspec = -> version {
-      command = "chruby #{version} && ../mspec/bin/mspec -j"
-      sh ENV["SHELL"], "-c", command
-    }
-    run_rubyspec[min_version]
-    run_rubyspec[max_version]
-    run_rubyspec["trunk"]
+  Dir.chdir(SOURCE_REPO) do
+    if MSPEC
+      sh "bundle", "exec", "rspec"
+    else
+      versions = YAML.load_file(".travis.yml")
+      versions = versions["matrix"]["include"].map { |job| job["rvm"] }
+      versions.delete "ruby-head"
+      min_version, max_version = versions.minmax
+
+      run_rubyspec = -> version {
+        command = "chruby #{version} && ../mspec/bin/mspec -j"
+        sh ENV["SHELL"], "-c", command
+      }
+      run_rubyspec[min_version]
+      run_rubyspec[max_version]
+      run_rubyspec["trunk"]
+    end
   end
 end
 
 def verify_commits(impl)
   puts
-  Dir.chdir(RUBYSPEC_REPO) do
+  Dir.chdir(SOURCE_REPO) do
     history = `git log master...`
     history.lines.slice_before(/^commit \h{40}$/).each do |commit, *message|
       commit = commit.chomp.split.last
@@ -182,7 +196,7 @@ def verify_commits(impl) https://github.com/ruby/ruby/blob/trunk/spec/mspec/tool/sync/sync-rubyspec.rb#L196
 end
 
 def fast_forward_master(impl)
-  Dir.chdir(RUBYSPEC_REPO) do
+  Dir.chdir(SOURCE_REPO) do
     sh "git", "checkout", "master"
     sh "git", "merge", "--ff-only", "#{impl.name}-rebased"
   end
@@ -192,7 +206,7 @@ def check_ci https://github.com/ruby/ruby/blob/trunk/spec/mspec/tool/sync/sync-rubyspec.rb#L206
   puts
   puts <<-EOS
   Push to master, and check that the CI passes:
-    https://github.com/ruby/spec/commits/master
+    https://github.com/ruby/#{:m if MSPEC}spec/commits/master
 
   EOS
 end
Index: spec/mspec/lib/mspec/runner/evaluate.rb
===================================================================
--- spec/mspec/lib/mspec/runner/evaluate.rb	(revision 59202)
+++ spec/mspec/lib/mspec/runner/evaluate.rb	(revision 59203)
@@ -1,4 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/spec/mspec/lib/mspec/runner/evaluate.rb#L1
 class SpecEvaluate
+  include MSpecMatchers
+
   def self.desc=(desc)
     @desc = desc
   end
@@ -47,8 +49,6 @@ class SpecEvaluate https://github.com/ruby/ruby/blob/trunk/spec/mspec/lib/mspec/runner/evaluate.rb#L49
   end
 end
 
-class Object
-  def evaluate(str, desc=nil, &block)
-    SpecEvaluate.new(str, desc).define(&block)
-  end
+def evaluate(str, desc=nil, &block)
+  SpecEvaluate.new(str, desc).define(&block)
 end
Index: spec/mspec/lib/mspec/runner/object.rb
===================================================================
--- spec/mspec/lib/mspec/runner/object.rb	(revision 59202)
+++ spec/mspec/lib/mspec/runner/object.rb	(revision 59203)
@@ -1,28 +1,26 @@ https://github.com/ruby/ruby/blob/trunk/spec/mspec/lib/mspec/runner/object.rb#L1
 class Object
-  def before(at=:each, &block)
+  private def before(at=:each, &block)
     MSpec.current.before at, &block
   end
 
-  def after(at=:each, &block)
+  private def after(at=:each, &block)
     MSpec.current.after at, &block
   end
 
-  def describe(mod, msg=nil, options=nil, &block)
+  private def describe(mod, msg=nil, options=nil, &block)
     MSpec.describe mod, msg, &block
   end
 
-  def it(msg, &block)
+  private def it(msg, &block)
     MSpec.current.it msg, &block
   end
 
-  def it_should_behave_like(desc)
+  private def it_should_behave_like(desc)
     MSpec.current.it_should_behave_like desc
   end
 
-  # For ReadRuby compatiability
-  def doc(*a)
-  end
-
   alias_method :context, :describe
+  private :context
   alias_method :specify, :it
+  private :specify
 end
Index: spec/mspec/lib/mspec/runner/shared.rb
===================================================================
--- spec/mspec/lib/mspec/runner/shared.rb	(revision 59202)
+++ spec/mspec/lib/mspec/runner/shared.rb	(revision 59203)
@@ -1,12 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/spec/mspec/lib/mspec/runner/shared.rb#L1
 require 'mspec/runner/mspec'
 
-class Object
-  def it_behaves_like(desc, meth, obj=nil)
-    send :before, :all do
-      @method = meth
-      @object = obj
-    end
-
-    send :it_should_behave_like, desc.to_s
+def it_behaves_like(desc, meth, obj=nil)
+  send :before, :all do
+    @method = meth
+    @object = obj
   end
+
+  send :it_should_behave_like, desc.to_s
 end
Index: spec/mspec/lib/mspec/runner/mspec.rb
===================================================================
--- spec/mspec/lib/mspec/runner/mspec.rb	(revision 59202)
+++ spec/mspec/lib/mspec/runner/mspec.rb	(revision 59203)
@@ -2,6 +2,10 @@ require 'mspec/runner/context' https://github.com/ruby/ruby/blob/trunk/spec/mspec/lib/mspec/runner/mspec.rb#L2
 require 'mspec/runner/exception'
 req (... truncated)

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

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