mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Update to ruby/mspec@e768949
This commit is contained in:
parent
95089ddaf4
commit
a375640ea5
2 changed files with 7 additions and 5 deletions
|
@ -135,16 +135,18 @@ def ruby_exe(code = :not_given, opts = {})
|
||||||
code = tmpfile
|
code = tmpfile
|
||||||
end
|
end
|
||||||
|
|
||||||
expected_exit_status = opts.fetch(:exit_status, 0)
|
expected_status = opts.fetch(:exit_status, 0)
|
||||||
|
|
||||||
begin
|
begin
|
||||||
platform_is_not :opal do
|
platform_is_not :opal do
|
||||||
command = ruby_cmd(code, opts)
|
command = ruby_cmd(code, opts)
|
||||||
output = `#{command}`
|
output = `#{command}`
|
||||||
|
|
||||||
last_status = Process.last_status
|
exit_status = Process.last_status.exitstatus
|
||||||
if last_status.exitstatus != expected_exit_status
|
if exit_status != expected_status
|
||||||
raise "Expected exit status is #{expected_exit_status.inspect} but actual is #{last_status.exitstatus.inspect} for command ruby_exe(#{command.inspect})"
|
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
|
end
|
||||||
|
|
||||||
output
|
output
|
||||||
|
|
|
@ -145,7 +145,7 @@ RSpec.describe Object, "#ruby_exe" do
|
||||||
stub_const 'RUBY_EXE', 'ruby_spec_exe -w -Q'
|
stub_const 'RUBY_EXE', 'ruby_spec_exe -w -Q'
|
||||||
|
|
||||||
@script = RubyExeSpecs.new
|
@script = RubyExeSpecs.new
|
||||||
allow(@script).to receive(:`)
|
allow(@script).to receive(:`).and_return('OUTPUT')
|
||||||
|
|
||||||
status_successful = double(Process::Status, exitstatus: 0)
|
status_successful = double(Process::Status, exitstatus: 0)
|
||||||
allow(Process).to receive(:last_status).and_return(status_successful)
|
allow(Process).to receive(:last_status).and_return(status_successful)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue