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

ruby-changes:67655

From: Benoit <ko1@a...>
Date: Wed, 8 Sep 2021 02:01:50 +0900 (JST)
Subject: [ruby-changes:67655] a375640ea5 (master): Update to ruby/mspec@e768949

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

From a375640ea561d1f7c4d2d89839007b3a973a04e0 Mon Sep 17 00:00:00 2001
From: Benoit Daloze <eregontp@g...>
Date: Tue, 7 Sep 2021 19:01:03 +0200
Subject: Update to ruby/mspec@e768949

---
 spec/mspec/lib/mspec/helpers/ruby_exe.rb | 10 ++++++----
 spec/mspec/spec/helpers/ruby_exe_spec.rb |  2 +-
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/spec/mspec/lib/mspec/helpers/ruby_exe.rb b/spec/mspec/lib/mspec/helpers/ruby_exe.rb
index c62c19f..4948ec0 100644
--- a/spec/mspec/lib/mspec/helpers/ruby_exe.rb
+++ b/spec/mspec/lib/mspec/helpers/ruby_exe.rb
@@ -135,16 +135,18 @@ def ruby_exe(code = :not_given, opts = {}) https://github.com/ruby/ruby/blob/trunk/spec/mspec/lib/mspec/helpers/ruby_exe.rb#L135
     code = tmpfile
   end
 
-  expected_exit_status = opts.fetch(:exit_status, 0)
+  expected_status = opts.fetch(:exit_status, 0)
 
   begin
     platform_is_not :opal do
       command = ruby_cmd(code, opts)
       output = `#{command}`
 
-      last_status = Process.last_status
-      if last_status.exitstatus != expected_exit_status
-        raise "Expected exit status is #{expected_exit_status.inspect} but actual is #{last_status.exitstatus.inspect} for command ruby_exe(#{command.inspect})"
+      exit_status = Process.last_status.exitstatus
+      if exit_status != expected_status
+        formatted_output = output.lines.map { |line| "  #{line}" }.join
+        raise SpecExpectationNotMetError,
+          "Expected exit status is #{expected_status.inspect} but actual is #{exit_status.inspect} for command ruby_exe(#{command.inspect})\nOutput:\n#{formatted_output}"
       end
 
       output
diff --git a/spec/mspec/spec/helpers/ruby_exe_spec.rb b/spec/mspec/spec/helpers/ruby_exe_spec.rb
index 8f14f63..79ce55c 100644
--- a/spec/mspec/spec/helpers/ruby_exe_spec.rb
+++ b/spec/mspec/spec/helpers/ruby_exe_spec.rb
@@ -145,7 +145,7 @@ RSpec.describe Object, "#ruby_exe" do https://github.com/ruby/ruby/blob/trunk/spec/mspec/spec/helpers/ruby_exe_spec.rb#L145
     stub_const 'RUBY_EXE', 'ruby_spec_exe -w -Q'
 
     @script = RubyExeSpecs.new
-    allow(@script).to receive(:`)
+    allow(@script).to receive(:`).and_return('OUTPUT')
 
     status_successful = double(Process::Status,  exitstatus: 0)
     allow(Process).to receive(:last_status).and_return(status_successful)
-- 
cgit v1.1


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

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