summaryrefslogtreecommitdiff
path: root/spec/ruby/core/exception/success_spec.rb
blob: 70af9c74eb56e52ea742767d0f73e3be9dacecdc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
require_relative '../../spec_helper'

describe "SystemExit#success?" do
  it "returns true if the process exited successfully" do
    -> { exit 0 }.should raise_error(SystemExit) { |e|
      e.success?.should == true
    }
  end

  it "returns false if the process exited unsuccessfully" do
    -> { exit(-1) }.should raise_error(SystemExit) { |e|
      e.success?.should == false
    }
  end
end