services-systemctl: fix testcases
Signed-off-by: botantony <antonsm21@gmail.com>
This commit is contained in:
parent
084ddca27a
commit
7a7395a229
@ -29,7 +29,7 @@ module Services
|
|||||||
_run(*args, mode: :read)
|
_run(*args, mode: :read)
|
||||||
end
|
end
|
||||||
|
|
||||||
sig { params(args: T.any(String, Pathname), mode: T.nilable(Symbol)).returns(T.untyped) }
|
sig { params(args: T.nilable(T.any(String, Pathname)), mode: T.nilable(Symbol)).returns(T.untyped) }
|
||||||
private_class_method def self._run(*args, mode:)
|
private_class_method def self._run(*args, mode:)
|
||||||
require "system_command"
|
require "system_command"
|
||||||
result = SystemCommand.run(executable,
|
result = SystemCommand.run(executable,
|
||||||
|
|||||||
@ -177,7 +177,7 @@ RSpec.describe Services::Cli do
|
|||||||
|
|
||||||
describe "#systemd_load", :needs_linux do
|
describe "#systemd_load", :needs_linux do
|
||||||
it "checks non-enabling run" do
|
it "checks non-enabling run" do
|
||||||
expect(Services::System::Systemctl).to receive(:executable).once.and_return("/bin/systemctl")
|
expect(Services::System::Systemctl).to receive(:executable).once.and_return(Pathname.new("/usr/bin/systemctl"))
|
||||||
expect(Services::System::Systemctl).to receive(:scope).once.and_return("--user")
|
expect(Services::System::Systemctl).to receive(:scope).once.and_return("--user")
|
||||||
services_cli.systemd_load(
|
services_cli.systemd_load(
|
||||||
instance_double(Services::FormulaWrapper, service_name: "name"),
|
instance_double(Services::FormulaWrapper, service_name: "name"),
|
||||||
@ -186,7 +186,7 @@ RSpec.describe Services::Cli do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "checks enabling run" do
|
it "checks enabling run" do
|
||||||
expect(Services::System::Systemctl).to receive(:executable).twice.and_return("/bin/systemctl")
|
expect(Services::System::Systemctl).to receive(:executable).once.and_return(Pathname.new("/usr/bin/systemctl"))
|
||||||
expect(Services::System::Systemctl).to receive(:scope).twice.and_return("--user")
|
expect(Services::System::Systemctl).to receive(:scope).twice.and_return("--user")
|
||||||
services_cli.systemd_load(
|
services_cli.systemd_load(
|
||||||
instance_double(Services::FormulaWrapper, service_name: "name"),
|
instance_double(Services::FormulaWrapper, service_name: "name"),
|
||||||
@ -198,14 +198,14 @@ RSpec.describe Services::Cli do
|
|||||||
describe "#launchctl_load", :needs_macos do
|
describe "#launchctl_load", :needs_macos do
|
||||||
it "checks non-enabling run" do
|
it "checks non-enabling run" do
|
||||||
expect(Services::System).to receive(:domain_target).once.and_return("target")
|
expect(Services::System).to receive(:domain_target).once.and_return("target")
|
||||||
expect(Services::System).to receive(:launchctl).once.and_return("/bin/launchctl")
|
expect(Services::System).to receive(:launchctl).once.and_return(Pathname.new("/bin/launchctl"))
|
||||||
expect(described_class).to receive(:safe_system).once.and_return(true)
|
expect(described_class).to receive(:safe_system).once.and_return(true)
|
||||||
services_cli.launchctl_load(instance_double(Services::FormulaWrapper), file: "a", enable: false)
|
services_cli.launchctl_load(instance_double(Services::FormulaWrapper), file: "a", enable: false)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "checks enabling run" do
|
it "checks enabling run" do
|
||||||
expect(Services::System).to receive(:domain_target).twice.and_return("target")
|
expect(Services::System).to receive(:domain_target).twice.and_return("target")
|
||||||
expect(Services::System).to receive(:launchctl).twice.and_return("/bin/launchctl")
|
expect(Services::System).to receive(:launchctl).once.and_return(Pathname.new("/bin/launchctl"))
|
||||||
expect(described_class).to receive(:safe_system).twice.and_return(true)
|
expect(described_class).to receive(:safe_system).twice.and_return(true)
|
||||||
services_cli.launchctl_load(instance_double(Services::FormulaWrapper, service_name: "name"), file: "a",
|
services_cli.launchctl_load(instance_double(Services::FormulaWrapper, service_name: "name"), file: "a",
|
||||||
enable: true)
|
enable: true)
|
||||||
|
|||||||
@ -18,7 +18,7 @@ RSpec.describe Services::System::Systemctl do
|
|||||||
|
|
||||||
describe ".executable" do
|
describe ".executable" do
|
||||||
it "outputs systemctl command location", :needs_linux do
|
it "outputs systemctl command location", :needs_linux do
|
||||||
expect(described_class.executable).to eq("/bin/systemctl")
|
expect(described_class.executable).to eq(Pathname.new("/usr/bin/systemctl"))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user