From 026709962d488ca34becb635cc0eb5e6316a0707 Mon Sep 17 00:00:00 2001 From: DenizUgur Date: Thu, 23 Feb 2023 11:02:20 -0800 Subject: [PATCH] update tests --- Library/Homebrew/test/service_spec.rb | 42 +++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/test/service_spec.rb b/Library/Homebrew/test/service_spec.rb index 6b08b4f03b..21546e7b04 100644 --- a/Library/Homebrew/test/service_spec.rb +++ b/Library/Homebrew/test/service_spec.rb @@ -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 + + + + + \tLabel + \thomebrew.mxcl.formula_name + \tLimitLoadToSessionType + \t + \t\tAqua + \t\tBackground + \t\tLoginWindow + \t\tStandardIO + \t\tSystem + \t + \tProgramArguments + \t + \t\t#{HOMEBREW_PREFIX}/opt/formula_name/bin/beanstalkd + \t + \tRunAtLoad + \t + + + 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#{HOMEBREW_PREFIX}/opt/formula_name/bin/beanstalkd \t \tRunAtLoad - \t + \t \tStartInterval \t5 @@ -415,7 +453,7 @@ describe Homebrew::Service do \t\t#{HOMEBREW_PREFIX}/opt/formula_name/bin/beanstalkd \t \tRunAtLoad - \t + \t \tStartCalendarInterval \t \t\tHour