| 
									
										
										
										
											2016-10-24 22:53:25 +02:00
										 |  |  | require "testing_env" | 
					
						
							| 
									
										
										
										
											2016-09-26 19:55:50 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-09-27 00:03:40 +02:00
										 |  |  | class IntegrationCommandTestSearch < IntegrationCommandTestCase | 
					
						
							| 
									
										
										
										
											2016-09-26 19:55:50 +02:00
										 |  |  |   def test_search | 
					
						
							|  |  |  |     setup_test_formula "testball" | 
					
						
							|  |  |  |     desc_cache = HOMEBREW_CACHE/"desc_cache.json" | 
					
						
							|  |  |  |     refute_predicate desc_cache, :exist?, "Cached file should not exist" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     assert_match "testball", cmd("search") | 
					
						
							|  |  |  |     assert_match "testball", cmd("search", "testball") | 
					
						
							|  |  |  |     assert_match "testball", cmd("search", "homebrew/homebrew-core/testball") | 
					
						
							|  |  |  |     assert_match "testball", cmd("search", "--desc", "Some test") | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     flags = { | 
					
						
							|  |  |  |       "macports" => "https://www.macports.org/ports.php?by=name&substr=testball", | 
					
						
							|  |  |  |       "fink" => "http://pdb.finkproject.org/pdb/browse.php?summary=testball", | 
					
						
							|  |  |  |       "debian" => "https://packages.debian.org/search?keywords=testball&searchon=names&suite=all§ion=all", | 
					
						
							|  |  |  |       "opensuse" => "https://software.opensuse.org/search?q=testball", | 
					
						
							|  |  |  |       "fedora" => "https://admin.fedoraproject.org/pkgdb/packages/%2Atestball%2A/", | 
					
						
							|  |  |  |       "ubuntu" => "http://packages.ubuntu.com/search?keywords=testball&searchon=names&suite=all§ion=all", | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     flags.each do |flag, url| | 
					
						
							|  |  |  |       assert_equal url, cmd("search", "--#{flag}", | 
					
						
							|  |  |  |         "testball", "HOMEBREW_BROWSER" => "echo") | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     assert_predicate desc_cache, :exist?, "Cached file should exist" | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | end |