summaryrefslogtreecommitdiff
path: root/spec/ruby/core/exception/success_spec.rb
blob: 6f2174334013605e403c916acdfd095942a0fd50 (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.should.success?
    }
  end

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