Skip to content

Commit

Permalink
Update specs
Browse files Browse the repository at this point in the history
  • Loading branch information
eregon committed Jun 26, 2022
1 parent d3bdbf5 commit 78b5d86
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions spec/helpers/ruby_exe_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ class RubyExeSpecs
@script = RubyExeSpecs.new
allow(@script).to receive(:`).and_return('OUTPUT')

status_successful = double(Process::Status, exitstatus: 0)
status_successful = double(Process::Status, exited?: true, exitstatus: 0)
allow(Process).to receive(:last_status).and_return(status_successful)
end

Expand Down Expand Up @@ -176,24 +176,24 @@ class RubyExeSpecs
code = "code"
options = {}

status_failed = double(Process::Status, exitstatus: 4)
status_failed = double(Process::Status, exited?: true, exitstatus: 4)
allow(Process).to receive(:last_status).and_return(status_failed)

expect {
@script.ruby_exe(code, options)
}.to raise_error(%r{Expected exit status is 0 but actual is 4 for command ruby_exe\(.+\)})
end

it "shows in the exception message if exitstatus is nil (e.g., signal)" do
it "shows in the exception message if a signal killed the process" do
code = "code"
options = {}

status_failed = double(Process::Status, exitstatus: nil)
status_failed = double(Process::Status, exited?: false, signaled?: true, termsig: Signal.list.fetch('TERM'))
allow(Process).to receive(:last_status).and_return(status_failed)

expect {
@script.ruby_exe(code, options)
}.to raise_error(%r{Expected exit status is 0 but actual is nil for command ruby_exe\(.+\)})
}.to raise_error(%r{Expected exit status is 0 but actual is :SIGTERM for command ruby_exe\(.+\)})
end

describe "with :dir option" do
Expand Down Expand Up @@ -236,7 +236,7 @@ class RubyExeSpecs

describe "with :exit_status option" do
before do
status_failed = double(Process::Status, exitstatus: 4)
status_failed = double(Process::Status, exited?: true, exitstatus: 4)
allow(Process).to receive(:last_status).and_return(status_failed)
end

Expand Down

0 comments on commit 78b5d86

Please sign in to comment.