Add tests.
This commit is contained in:
parent
7eff8957c4
commit
3484fa319b
@ -587,6 +587,44 @@ describe Homebrew::Service do
|
||||
EOS
|
||||
expect(plist).to eq(plist_expect)
|
||||
end
|
||||
|
||||
it "expands paths" do
|
||||
f = stub_formula do
|
||||
service do
|
||||
run opt_bin/"beanstalkd"
|
||||
working_dir "~"
|
||||
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<true/>
|
||||
\t<key>WorkingDirectory</key>
|
||||
\t<string>#{Dir.home}</string>
|
||||
</dict>
|
||||
</plist>
|
||||
EOS
|
||||
expect(plist).to eq(plist_expect)
|
||||
end
|
||||
end
|
||||
|
||||
describe "#to_systemd_unit" do
|
||||
@ -657,6 +695,30 @@ describe Homebrew::Service do
|
||||
EOS
|
||||
expect(unit).to eq(unit_expect.strip)
|
||||
end
|
||||
|
||||
it "expands paths" do
|
||||
f = stub_formula do
|
||||
service do
|
||||
run opt_bin/"beanstalkd"
|
||||
working_dir "~"
|
||||
end
|
||||
end
|
||||
|
||||
unit = f.service.to_systemd_unit
|
||||
unit_expect = <<~EOS
|
||||
[Unit]
|
||||
Description=Homebrew generated unit for formula_name
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=#{HOMEBREW_PREFIX}/opt/#{name}/bin/beanstalkd
|
||||
WorkingDirectory=#{Dir.home}
|
||||
EOS
|
||||
expect(unit).to eq(unit_expect.strip)
|
||||
end
|
||||
end
|
||||
|
||||
describe "#to_systemd_timer" do
|
||||
|
Loading…
x
Reference in New Issue
Block a user