spec_helper: add :needs_systemd
Signed-off-by: botantony <antonsm21@gmail.com>
This commit is contained in:
parent
0d3cbcad41
commit
25b9000c77
@ -181,6 +181,8 @@ module Services
|
||||
sig { returns(T.nilable(Integer)) }
|
||||
def pid
|
||||
status_output, _, status_type = status_output_success_type
|
||||
return if status_type.nil?
|
||||
|
||||
Regexp.last_match(1).to_i if status_output =~ pid_regex(status_type)
|
||||
end
|
||||
|
||||
@ -188,6 +190,8 @@ module Services
|
||||
sig { returns(T.nilable(Integer)) }
|
||||
def exit_code
|
||||
status_output, _, status_type = status_output_success_type
|
||||
return if status_type.nil?
|
||||
|
||||
Regexp.last_match(1).to_i if status_output =~ exit_code_regex(status_type)
|
||||
end
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
require "cmd/services"
|
||||
require "cmd/shared_examples/args_parse"
|
||||
|
||||
RSpec.describe Homebrew::Cmd::Services do
|
||||
RSpec.describe Homebrew::Cmd::Services, :needs_daemon_manager do
|
||||
it_behaves_like "parseable arguments"
|
||||
|
||||
it "allows controlling services", :integration_test do
|
||||
|
||||
@ -24,7 +24,7 @@ RSpec.describe Services::System do
|
||||
end
|
||||
|
||||
describe "#systemctl?" do
|
||||
it "Linux - outputs systemctl presence", :needs_linux do
|
||||
it "Linux with SystemD - outputs systemctl presence", :needs_systemd do
|
||||
expect(described_class.systemctl?).to be(true)
|
||||
end
|
||||
|
||||
|
||||
@ -171,6 +171,14 @@ RSpec.configure do |config|
|
||||
skip "Requires homebrew/core to be tapped." unless Dir.exist?(core_tap_path)
|
||||
end
|
||||
|
||||
config.before(:each, :needs_systemd) do
|
||||
skip "No SystemD found." unless which("systemctl")
|
||||
end
|
||||
|
||||
config.before(:each, :needs_daemon_manager) do
|
||||
skip "No LaunchCTL or SystemD found." if !which("systemctl") && !which("launchctl")
|
||||
end
|
||||
|
||||
config.before do |example|
|
||||
next if example.metadata.key?(:needs_network)
|
||||
next if example.metadata.key?(:needs_utils_curl)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user