Skip to content

Commit 283e646

Browse files
committed
1 parent dde1b60 commit 283e646

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

spec/mspec/lib/mspec/runner/shared.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
require 'mspec/runner/mspec'
22

33
def it_behaves_like(desc, meth, obj = nil)
4-
send :before, :all do
4+
before :all do
55
@method = meth
66
@object = obj
77
end
8+
after :all do
9+
@method = nil
10+
@object = nil
11+
end
812

9-
send :it_should_behave_like, desc.to_s
13+
it_should_behave_like desc.to_s
1014
end

spec/mspec/spec/helpers/ruby_exe_spec.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ class RubyExeSpecs
147147
@script = RubyExeSpecs.new
148148
allow(@script).to receive(:`).and_return('OUTPUT')
149149

150-
status_successful = double(Process::Status, exitstatus: 0)
150+
status_successful = double(Process::Status, exited?: true, exitstatus: 0)
151151
allow(Process).to receive(:last_status).and_return(status_successful)
152152
end
153153

@@ -176,24 +176,24 @@ class RubyExeSpecs
176176
code = "code"
177177
options = {}
178178

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

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

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

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

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

199199
describe "with :dir option" do
@@ -236,7 +236,7 @@ class RubyExeSpecs
236236

237237
describe "with :exit_status option" do
238238
before do
239-
status_failed = double(Process::Status, exitstatus: 4)
239+
status_failed = double(Process::Status, exited?: true, exitstatus: 4)
240240
allow(Process).to receive(:last_status).and_return(status_failed)
241241
end
242242

0 commit comments

Comments
 (0)