mirror of
https://github.com/donl/homebrew-cask-versions.git
synced 2026-07-17 14:26:45 -06:00
* convert existing Cask:: namespace to Hbc:: * move Homebrew-fork code under Hbc:: * move freestanding classes such as Tty and TopologicalHash under Hbc:: * recast HOMEBREW_CASK_ constants as HBC_ * modify our Homebrew Formula for backward compatibility * devscripts and dev docs
57 lines
1.3 KiB
Ruby
57 lines
1.3 KiB
Ruby
require 'test_helper'
|
|
|
|
describe Hbc::SystemCommand do
|
|
describe "when the exit code is 0" do
|
|
result = nil
|
|
|
|
before do
|
|
command = '/usr/bin/true'
|
|
options = {
|
|
:must_succeed => false
|
|
}
|
|
result = Hbc::SystemCommand.run(command, options)
|
|
end
|
|
|
|
it "says the command was successful" do
|
|
result.success?.must_equal(true)
|
|
end
|
|
|
|
it "says the exit status is 0" do
|
|
result.exit_status.must_equal(0)
|
|
end
|
|
end
|
|
|
|
describe "when the exit code is 1" do
|
|
describe "and the command must succeed" do
|
|
it "throws an error" do
|
|
lambda {
|
|
command = '/usr/bin/false'
|
|
options = {
|
|
:must_succeed => true
|
|
}
|
|
result = Hbc::SystemCommand.run(command, options)
|
|
}.must_raise(Hbc::CaskCommandFailedError)
|
|
end
|
|
end
|
|
|
|
describe "and the command does not have to succeed" do
|
|
result = nil
|
|
|
|
before do
|
|
command = '/usr/bin/false'
|
|
options = {
|
|
:must_succeed => false
|
|
}
|
|
result = Hbc::SystemCommand.run(command, options)
|
|
end
|
|
|
|
it "says the command failed" do
|
|
result.success?.must_equal(false)
|
|
end
|
|
|
|
it "says the exit status is 1" do
|
|
result.exit_status.must_equal(1)
|
|
end
|
|
end
|
|
end
|
|
end
|