| 
									
										
										
										
											2020-10-10 14:16:11 +02:00
										 |  |  | # typed: false | 
					
						
							| 
									
										
										
										
											2019-04-19 15:38:03 +09:00
										 |  |  | # frozen_string_literal: true | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-15 03:33:21 +01:00
										 |  |  | require "descriptions" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | describe Descriptions do | 
					
						
							| 
									
										
										
										
											2021-01-31 13:14:23 -05:00
										 |  |  |   subject(:descriptions) { described_class.new(descriptions_hash) } | 
					
						
							| 
									
										
										
										
											2018-03-25 13:30:37 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-15 03:33:21 +01:00
										 |  |  |   let(:descriptions_hash) { {} } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   it "can print description for a core Formula" do | 
					
						
							|  |  |  |     descriptions_hash["homebrew/core/foo"] = "Core foo" | 
					
						
							| 
									
										
										
										
											2021-01-31 13:14:23 -05:00
										 |  |  |     expect { descriptions.print }.to output("foo: Core foo\n").to_stdout | 
					
						
							| 
									
										
										
										
											2017-02-15 03:33:21 +01:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   it "can print description for an external Formula" do | 
					
						
							|  |  |  |     descriptions_hash["somedev/external/foo"] = "External foo" | 
					
						
							| 
									
										
										
										
											2021-01-31 13:14:23 -05:00
										 |  |  |     expect { descriptions.print }.to output("foo: External foo\n").to_stdout | 
					
						
							| 
									
										
										
										
											2017-02-15 03:33:21 +01:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   it "can print descriptions for duplicate Formulae" do | 
					
						
							|  |  |  |     descriptions_hash["homebrew/core/foo"] = "Core foo" | 
					
						
							|  |  |  |     descriptions_hash["somedev/external/foo"] = "External foo" | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-01-31 13:14:23 -05:00
										 |  |  |     expect { descriptions.print }.to output( | 
					
						
							| 
									
										
										
										
											2019-02-11 09:50:09 +00:00
										 |  |  |       <<~EOS, | 
					
						
							| 
									
										
										
										
											2017-02-15 03:33:21 +01:00
										 |  |  |         homebrew/core/foo: Core foo | 
					
						
							|  |  |  |         somedev/external/foo: External foo | 
					
						
							|  |  |  |       EOS | 
					
						
							|  |  |  |     ).to_stdout | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   it "can print descriptions for duplicate core and external Formulae" do | 
					
						
							|  |  |  |     descriptions_hash["homebrew/core/foo"] = "Core foo" | 
					
						
							|  |  |  |     descriptions_hash["somedev/external/foo"] = "External foo" | 
					
						
							|  |  |  |     descriptions_hash["otherdev/external/foo"] = "Other external foo" | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-01-31 13:14:23 -05:00
										 |  |  |     expect { descriptions.print }.to output( | 
					
						
							| 
									
										
										
										
											2019-02-11 09:50:09 +00:00
										 |  |  |       <<~EOS, | 
					
						
							| 
									
										
										
										
											2017-02-15 03:33:21 +01:00
										 |  |  |         homebrew/core/foo: Core foo | 
					
						
							|  |  |  |         otherdev/external/foo: Other external foo | 
					
						
							|  |  |  |         somedev/external/foo: External foo | 
					
						
							|  |  |  |       EOS | 
					
						
							|  |  |  |     ).to_stdout | 
					
						
							|  |  |  |   end | 
					
						
							| 
									
										
										
										
											2022-03-23 00:03:11 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  |   it "can print description for a cask" do | 
					
						
							|  |  |  |     descriptions_hash["homebrew/cask/foo"] = ["Foo", "Cask foo"] | 
					
						
							|  |  |  |     expect { descriptions.print }.to output("foo: (Foo) Cask foo\n").to_stdout | 
					
						
							|  |  |  |   end | 
					
						
							| 
									
										
										
										
											2017-02-15 03:33:21 +01:00
										 |  |  | end |