diff options
Diffstat (limited to 'spec/ruby/shared/process/fork.rb')
| -rw-r--r-- | spec/ruby/shared/process/fork.rb | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/spec/ruby/shared/process/fork.rb b/spec/ruby/shared/process/fork.rb index 8dbb3d0da4..dd595cd93e 100644 --- a/spec/ruby/shared/process/fork.rb +++ b/spec/ruby/shared/process/fork.rb @@ -3,12 +3,12 @@ describe :process_fork, shared: true do it "returns false from #respond_to?" do # Workaround for Kernel::Method being public and losing the "non-respond_to? magic" mod = @object.class.name == "KernelSpecs::Method" ? Object.new : @object - mod.respond_to?(:fork).should be_false - mod.respond_to?(:fork, true).should be_false + mod.respond_to?(:fork).should == false + mod.respond_to?(:fork, true).should == false end it "raises a NotImplementedError when called" do - -> { @object.fork }.should raise_error(NotImplementedError) + -> { @object.fork }.should.raise(NotImplementedError) end end @@ -74,16 +74,19 @@ describe :process_fork, shared: true do it "marks threads from the parent as killed" do t = Thread.new { sleep } - pid = @object.fork { - touch(@file) do |f| - f.write Thread.current.alive? - f.write t.alive? - end - Process.exit! - } - Process.waitpid(pid) - t.kill - t.join + begin + pid = @object.fork { + touch(@file) do |f| + f.write Thread.current.alive? + f.write t.alive? + end + Process.exit! + } + Process.waitpid(pid) + ensure + t.kill + t.join + end File.read(@file).should == "truefalse" end end |
