update tests

This commit is contained in:
DenizUgur 2023-02-23 11:02:20 -08:00
parent f4ed502350
commit 026709962d

View File

@ -185,6 +185,7 @@ describe Homebrew::Service do
service do
run [opt_bin/"beanstalkd", "test"]
run_type :immediate
run_at_load true
environment_variables PATH: std_service_path_env, FOO: "BAR", ETC_DIR: etc/"beanstalkd"
error_log_path var/"log/beanstalkd.error.log"
log_path var/"log/beanstalkd.log"
@ -346,6 +347,43 @@ describe Homebrew::Service do
expect(plist).to eq(plist_expect)
end
it "returns valid partial plist" do
f = stub_formula do
service do
run opt_bin/"beanstalkd"
run_type :immediate
run_at_load false
end
end
plist = f.service.to_plist
plist_expect = <<~EOS
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
\t<key>Label</key>
\t<string>homebrew.mxcl.formula_name</string>
\t<key>LimitLoadToSessionType</key>
\t<array>
\t\t<string>Aqua</string>
\t\t<string>Background</string>
\t\t<string>LoginWindow</string>
\t\t<string>StandardIO</string>
\t\t<string>System</string>
\t</array>
\t<key>ProgramArguments</key>
\t<array>
\t\t<string>#{HOMEBREW_PREFIX}/opt/formula_name/bin/beanstalkd</string>
\t</array>
\t<key>RunAtLoad</key>
\t<false/>
</dict>
</plist>
EOS
expect(plist).to eq(plist_expect)
end
it "returns valid interval plist" do
f = stub_formula do
service do
@ -376,7 +414,7 @@ describe Homebrew::Service do
\t\t<string>#{HOMEBREW_PREFIX}/opt/formula_name/bin/beanstalkd</string>
\t</array>
\t<key>RunAtLoad</key>
\t<false/>
\t<true/>
\t<key>StartInterval</key>
\t<integer>5</integer>
</dict>
@ -415,7 +453,7 @@ describe Homebrew::Service do
\t\t<string>#{HOMEBREW_PREFIX}/opt/formula_name/bin/beanstalkd</string>
\t</array>
\t<key>RunAtLoad</key>
\t<false/>
\t<true/>
\t<key>StartCalendarInterval</key>
\t<dict>
\t\t<key>Hour</key>