2019-04-19 15:38:03 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								# frozen_string_literal: true
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-06 08:29:14 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								describe Cask::Cmd::InternalStanza, :cask do
							 | 
						
					
						
							
								
									
										
										
										
											2017-10-07 21:32:40 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  it "shows stanza of the Specified Cask" do
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-29 05:34:32 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    command = described_class.new("homepage", "local-caffeine")
							 | 
						
					
						
							
								
									
										
										
										
											2017-10-08 17:41:03 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    expect {
							 | 
						
					
						
							
								
									
										
										
										
											2017-10-08 09:59:29 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      command.run
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-28 20:51:55 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    }.to output("https://brew.sh\n").to_stdout
							 | 
						
					
						
							
								
									
										
										
										
											2017-10-07 21:32:40 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  end
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2017-10-22 13:43:17 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  it "raises an exception when stanza is unknown/unsupported" do
							 | 
						
					
						
							
								
									
										
										
										
											2017-10-08 17:41:03 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    expect {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-29 05:34:32 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      described_class.new("this_stanza_does_not_exist", "local-caffeine")
							 | 
						
					
						
							
								
									
										
										
										
											2017-10-23 06:49:12 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    }.to raise_error(%r{Unknown/unsupported stanza})
							 | 
						
					
						
							
								
									
										
										
										
											2017-10-07 21:32:40 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  end
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  it "raises an exception when normal stanza is not present on cask" do
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-29 05:34:32 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    command = described_class.new("caveats", "local-caffeine")
							 | 
						
					
						
							
								
									
										
										
										
											2017-10-08 17:41:03 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    expect {
							 | 
						
					
						
							
								
									
										
										
										
											2017-10-07 23:07:31 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      command.run
							 | 
						
					
						
							
								
									
										
										
										
											2017-10-08 17:41:03 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    }.to raise_error(/no such stanza/)
							 | 
						
					
						
							
								
									
										
										
										
											2017-10-07 21:32:40 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  end
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  it "raises an exception when artifact stanza is not present on cask" do
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-29 05:34:32 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    command = described_class.new("zap", "local-caffeine")
							 | 
						
					
						
							
								
									
										
										
										
											2017-10-08 17:41:03 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    expect {
							 | 
						
					
						
							
								
									
										
										
										
											2017-10-07 23:07:31 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      command.run
							 | 
						
					
						
							
								
									
										
										
										
											2017-10-08 17:41:03 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    }.to raise_error(/no such stanza/)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  end
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  it "raises an exception when 'depends_on' stanza is not present on cask" do
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-29 05:34:32 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    command = described_class.new("depends_on", "local-caffeine")
							 | 
						
					
						
							
								
									
										
										
										
											2017-10-08 17:41:03 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    expect {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      command.run
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    }.to raise_error(/no such stanza/)
							 | 
						
					
						
							
								
									
										
										
										
											2017-10-07 21:32:40 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  end
							 | 
						
					
						
							
								
									
										
										
										
											2017-10-08 12:34:15 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  it "shows all artifact stanzas when using 'artifacts' keyword" do
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-29 05:34:32 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    command = described_class.new("artifacts", "local-caffeine")
							 | 
						
					
						
							
								
									
										
										
										
											2017-10-08 17:41:03 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    expect {
							 | 
						
					
						
							
								
									
										
										
										
											2017-10-08 12:34:15 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      command.run
							 | 
						
					
						
							
								
									
										
										
										
											2017-10-22 13:43:17 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    }.to output(/Caffeine\.app/).to_stdout
							 | 
						
					
						
							
								
									
										
										
										
											2017-10-08 12:34:15 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  end
							 | 
						
					
						
							
								
									
										
										
										
											2017-10-07 21:32:40 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								end
							 |