 1d404e437b
			
		
	
	
		1d404e437b
		
			
		
	
	
	
	
		
			
			The existing watchlist test in `dev-cmd/livecheck_spec.rb` will only pass if the testing environment doesn't contain a livecheck watchlist file. When a watchlist file is present, it ends up being treated as empty (formulae and casks aren't available in tests) and produces an `Invalid usage: No formulae or casks to check` error instead. We don't have to worry about a watchlist file on CI but it's a potential issue when running `brew test` locally. This provides a bogus `HOMEBREW_LIVECHECK_WATCHLIST` value to the `#brew` call, to ensure that any watchlist file in the testing environment is not used for this test. Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
		
			
				
	
	
		
			29 lines
		
	
	
		
			921 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
			
		
		
	
	
			29 lines
		
	
	
		
			921 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
| # frozen_string_literal: true
 | |
| 
 | |
| require "cmd/shared_examples/args_parse"
 | |
| 
 | |
| describe "brew livecheck" do
 | |
|   it_behaves_like "parseable arguments"
 | |
| 
 | |
|   it "reports the latest version of a Formula", :integration_test, :needs_network do
 | |
|     content = <<~RUBY
 | |
|       desc "Some test"
 | |
|       homepage "https://github.com/Homebrew/brew"
 | |
|       url "https://brew.sh/test-1.0.0.tgz"
 | |
|     RUBY
 | |
|     setup_test_formula("test", content)
 | |
| 
 | |
|     expect { brew "livecheck", "test" }
 | |
|       .to output(/test: /).to_stdout
 | |
|       .and not_to_output.to_stderr
 | |
|       .and be_a_success
 | |
|   end
 | |
| 
 | |
|   it "gives an error when no arguments are given and there's no watchlist", :integration_test do
 | |
|     expect { brew "livecheck", "HOMEBREW_LIVECHECK_WATCHLIST" => ".this_should_not_exist" }
 | |
|       .to output(/Invalid usage: A watchlist file is required when no arguments are given\./).to_stderr
 | |
|       .and not_to_output.to_stdout
 | |
|       .and be_a_failure
 | |
|   end
 | |
| end
 |