2020-08-02 00:59:36 +05:30
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# frozen_string_literal: true
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								require "cmd/shared_examples/args_parse"
							 | 
						
					
						
							
								
									
										
										
										
											2024-03-21 10:48:43 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								require "dev-cmd/livecheck"
							 | 
						
					
						
							
								
									
										
										
										
											2020-08-02 00:59:36 +05:30
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2024-03-21 10:48:43 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								RSpec.describe Homebrew::DevCmd::LivecheckCmd do
							 | 
						
					
						
							
								
									
										
										
										
											2020-08-02 00:59:36 +05:30
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  it_behaves_like "parseable arguments"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2021-02-01 16:14:25 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  it "reports the latest version of a Formula", :integration_test, :needs_network do
							 | 
						
					
						
							
								
									
										
										
										
											2020-08-02 00:59:36 +05:30
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    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" }
							 | 
						
					
						
							
								
									
										
										
										
											2022-04-26 20:44:43 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      .to output(/test: /).to_stdout
							 | 
						
					
						
							
								
									
										
										
										
											2020-08-02 00:59:36 +05:30
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .and not_to_output.to_stderr
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .and be_a_success
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  end
							 | 
						
					
						
							
								
									
										
										
										
											2020-12-19 23:02:42 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2021-02-01 16:14:25 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  it "gives an error when no arguments are given and there's no watchlist", :integration_test do
							 | 
						
					
						
							
								
									
										
										
										
											2023-08-16 12:53:50 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    expect { brew "livecheck", "HOMEBREW_LIVECHECK_WATCHLIST" => ".this_should_not_exist" }
							 | 
						
					
						
							
								
									
										
										
										
											2020-12-19 23:02:42 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      .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
							 | 
						
					
						
							
								
									
										
										
										
											2020-08-02 00:59:36 +05:30
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								end
							 |