| 
									
										
										
										
											2019-04-19 15:38:03 +09:00
										 |  |  | # frozen_string_literal: true | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-23 06:02:51 +01:00
										 |  |  | describe "brew custom-external-command", :integration_test do | 
					
						
							|  |  |  |   it "is supported" do | 
					
						
							| 
									
										
										
										
											2017-02-28 14:50:46 +01:00
										 |  |  |     mktmpdir do |path| | 
					
						
							| 
									
										
										
										
											2017-02-23 06:02:51 +01:00
										 |  |  |       cmd = "custom-external-command-#{rand}" | 
					
						
							|  |  |  |       file = path/"brew-#{cmd}" | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-11 15:17:40 +02:00
										 |  |  |       file.write <<~SH | 
					
						
							| 
									
										
										
										
											2017-02-23 06:02:51 +01:00
										 |  |  |         #!/bin/sh | 
					
						
							|  |  |  |         echo 'I am #{cmd}.' | 
					
						
							| 
									
										
										
										
											2018-07-11 15:17:40 +02:00
										 |  |  |       SH | 
					
						
							| 
									
										
										
										
											2017-02-23 06:02:51 +01:00
										 |  |  |       FileUtils.chmod "+x", file | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-06-15 05:40:43 +01:00
										 |  |  |       expect { brew cmd, "PATH" => "#{path}#{File::PATH_SEPARATOR}#{ENV.fetch("PATH")}" } | 
					
						
							| 
									
										
										
										
											2017-02-23 06:02:51 +01:00
										 |  |  |         .to output("I am #{cmd}.\n").to_stdout | 
					
						
							|  |  |  |         .and not_to_output.to_stderr | 
					
						
							|  |  |  |         .and be_a_success | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | end |