| 
									
										
										
										
											2017-02-23 06:05:26 +01:00
										 |  |  | describe "brew", :integration_test do | 
					
						
							|  |  |  |   it "prints help when no argument is given" do | 
					
						
							|  |  |  |     expect { brew } | 
					
						
							|  |  |  |       .to output(/Example usage:\n/).to_stderr | 
					
						
							|  |  |  |       .and be_a_failure | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   describe "help" do | 
					
						
							|  |  |  |     it "prints help" do | 
					
						
							|  |  |  |       expect { brew "help" } | 
					
						
							|  |  |  |         .to output(/Example usage:\n/).to_stdout | 
					
						
							|  |  |  |         .and be_a_success | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     it "prints help for a documented Ruby command" do | 
					
						
							|  |  |  |       expect { brew "help", "cat" } | 
					
						
							| 
									
										
										
										
											2019-01-18 22:17:46 +05:30
										 |  |  |         .to output(/^Usage: brew cat/).to_stdout | 
					
						
							| 
									
										
										
										
											2017-02-23 06:05:26 +01:00
										 |  |  |         .and be_a_success | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     it "prints help for a documented shell command" do | 
					
						
							|  |  |  |       expect { brew "help", "update" } | 
					
						
							| 
									
										
										
										
											2019-01-30 21:34:21 +00:00
										 |  |  |         .to output(/^Usage: brew update/).to_stdout | 
					
						
							| 
									
										
										
										
											2017-02-23 06:05:26 +01:00
										 |  |  |         .and be_a_success | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     it "prints help for a documented Ruby developer command" do | 
					
						
							|  |  |  |       expect { brew "help", "update-test" } | 
					
						
							| 
									
										
										
										
											2018-10-03 21:12:44 +05:30
										 |  |  |         .to output(/^Usage: brew update-test/).to_stdout | 
					
						
							| 
									
										
										
										
											2017-02-23 06:05:26 +01:00
										 |  |  |         .and be_a_success | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     it "fails when given an unknown command" do | 
					
						
							|  |  |  |       expect { brew "help", "command-that-does-not-exist" } | 
					
						
							|  |  |  |         .to output(/Unknown command: command-that-does-not-exist/).to_stderr | 
					
						
							|  |  |  |         .and be_a_failure | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   describe "cat" do | 
					
						
							|  |  |  |     it "prints help when no argument is given" do | 
					
						
							|  |  |  |       expect { brew "cat" } | 
					
						
							| 
									
										
										
										
											2019-01-18 22:17:46 +05:30
										 |  |  |         .to output(/^Usage: brew cat/).to_stderr | 
					
						
							| 
									
										
										
										
											2017-02-23 06:05:26 +01:00
										 |  |  |         .and be_a_failure | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | end |