| 
									
										
										
										
											2017-10-03 10:49:58 +02:00
										 |  |  | require_relative "shared_examples/requires_cask_token" | 
					
						
							|  |  |  | require_relative "shared_examples/invalid_option" | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-05 19:26:56 +01:00
										 |  |  | describe Hbc::CLI::Cat, :cask do | 
					
						
							| 
									
										
										
										
											2017-10-03 10:49:58 +02:00
										 |  |  |   it_behaves_like "a command that requires a Cask token" | 
					
						
							|  |  |  |   it_behaves_like "a command that handles invalid options" | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-18 22:11:42 +03:00
										 |  |  |   describe "given a basic Cask" do | 
					
						
							| 
									
										
										
										
											2017-05-21 02:32:46 +02:00
										 |  |  |     let(:basic_cask_content) { | 
					
						
							| 
									
										
										
										
											2018-07-11 15:17:40 +02:00
										 |  |  |       <<~RUBY | 
					
						
							| 
									
										
										
										
											2017-02-03 21:52:51 +01:00
										 |  |  |         cask 'basic-cask' do | 
					
						
							| 
									
										
										
										
											2016-08-18 22:11:42 +03:00
										 |  |  |           version '1.2.3' | 
					
						
							|  |  |  |           sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b' | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |           url 'http://example.com/TestCask.dmg' | 
					
						
							|  |  |  |           homepage 'http://example.com/' | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |           app 'TestCask.app' | 
					
						
							|  |  |  |         end | 
					
						
							| 
									
										
										
										
											2018-07-11 15:17:40 +02:00
										 |  |  |       RUBY | 
					
						
							| 
									
										
										
										
											2017-02-08 12:01:03 +01:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2016-08-18 22:11:42 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  |     it "displays the Cask file content about the specified Cask" do | 
					
						
							| 
									
										
										
										
											2017-02-08 12:01:03 +01:00
										 |  |  |       expect { | 
					
						
							| 
									
										
										
										
											2017-10-03 10:49:58 +02:00
										 |  |  |         described_class.run("basic-cask") | 
					
						
							| 
									
										
										
										
											2017-05-21 02:32:46 +02:00
										 |  |  |       }.to output(basic_cask_content).to_stdout | 
					
						
							| 
									
										
										
										
											2016-08-18 22:11:42 +03:00
										 |  |  |     end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-05-21 02:32:46 +02:00
										 |  |  |     it "can display multiple Casks" do | 
					
						
							| 
									
										
										
										
											2017-02-08 12:01:03 +01:00
										 |  |  |       expect { | 
					
						
							| 
									
										
										
										
											2017-10-03 10:49:58 +02:00
										 |  |  |         described_class.run("basic-cask", "basic-cask") | 
					
						
							| 
									
										
										
										
											2017-05-21 02:32:46 +02:00
										 |  |  |       }.to output(basic_cask_content * 2).to_stdout | 
					
						
							| 
									
										
										
										
											2016-08-18 22:11:42 +03:00
										 |  |  |     end | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   it "raises an exception when the Cask does not exist" do | 
					
						
							| 
									
										
										
										
											2017-10-03 10:49:58 +02:00
										 |  |  |     expect { described_class.run("notacask") } | 
					
						
							| 
									
										
										
										
											2017-09-11 08:37:15 +02:00
										 |  |  |       .to raise_error(Hbc::CaskUnavailableError, /is unavailable/) | 
					
						
							| 
									
										
										
										
											2016-08-18 22:11:42 +03:00
										 |  |  |   end | 
					
						
							|  |  |  | end |