| 
									
										
										
										
											2019-04-19 15:38:03 +09:00
										 |  |  | # frozen_string_literal: true | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-27 18:33:42 +01:00
										 |  |  | require "formula" | 
					
						
							|  |  |  | require "software_spec" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | describe Bottle::Filename do | 
					
						
							| 
									
										
										
										
											2018-08-06 15:02:52 +02:00
										 |  |  |   subject { described_class.new(name, version, tag, rebuild) } | 
					
						
							| 
									
										
										
										
											2017-02-27 18:33:42 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-08 11:42:32 -07:00
										 |  |  |   let(:name) { "user/repo/foo" } | 
					
						
							| 
									
										
										
										
											2018-08-06 15:02:52 +02:00
										 |  |  |   let(:version) { "1.0" } | 
					
						
							|  |  |  |   let(:tag) { :tag } | 
					
						
							|  |  |  |   let(:rebuild) { 0 } | 
					
						
							| 
									
										
										
										
											2017-02-27 18:33:42 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-06 15:02:52 +02:00
										 |  |  |   describe "#extname" do | 
					
						
							|  |  |  |     its(:extname) { is_expected.to eq ".tag.bottle.tar.gz" } | 
					
						
							| 
									
										
										
										
											2017-02-27 18:33:42 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-06 15:02:52 +02:00
										 |  |  |     context "when rebuild is 0" do | 
					
						
							|  |  |  |       its(:extname) { is_expected.to eq ".tag.bottle.tar.gz" } | 
					
						
							|  |  |  |     end | 
					
						
							| 
									
										
										
										
											2017-02-27 18:33:42 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-06 15:02:52 +02:00
										 |  |  |     context "when rebuild is 1" do | 
					
						
							|  |  |  |       let(:rebuild) { 1 } | 
					
						
							| 
									
										
										
										
											2018-09-20 09:07:56 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-06 15:02:52 +02:00
										 |  |  |       its(:extname) { is_expected.to eq ".tag.bottle.1.tar.gz" } | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  |   end | 
					
						
							| 
									
										
										
										
											2017-02-27 18:33:42 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-06 15:02:52 +02:00
										 |  |  |   describe "#to_s and #to_str" do | 
					
						
							|  |  |  |     its(:to_s) { is_expected.to eq "foo--1.0.tag.bottle.tar.gz" } | 
					
						
							|  |  |  |     its(:to_str) { is_expected.to eq "foo--1.0.tag.bottle.tar.gz" } | 
					
						
							| 
									
										
										
										
											2017-02-27 18:33:42 +01:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-04-12 14:48:58 +01:00
										 |  |  |   describe "#url_encode" do | 
					
						
							|  |  |  |     its(:url_encode) { is_expected.to eq "foo-1.0.tag.bottle.tar.gz" } | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   describe "#github_packages" do | 
					
						
							|  |  |  |     its(:github_packages) { is_expected.to eq "foo--1.0.tag.bottle.tar.gz" } | 
					
						
							| 
									
										
										
										
											2018-08-06 15:02:52 +02:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   describe "#json" do | 
					
						
							|  |  |  |     its(:json) { is_expected.to eq "foo--1.0.tag.bottle.json" } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     context "when rebuild is 1" do | 
					
						
							|  |  |  |       its(:json) { is_expected.to eq "foo--1.0.tag.bottle.json" } | 
					
						
							| 
									
										
										
										
											2017-02-27 18:33:42 +01:00
										 |  |  |     end | 
					
						
							| 
									
										
										
										
											2018-08-06 15:02:52 +02:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   describe "::create" do | 
					
						
							|  |  |  |     subject { described_class.create(f, :tag, 0) } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-08 23:14:46 +00:00
										 |  |  |     let(:f) do | 
					
						
							| 
									
										
										
										
											2018-08-06 15:02:52 +02:00
										 |  |  |       formula do | 
					
						
							| 
									
										
										
										
											2018-11-28 20:51:55 +01:00
										 |  |  |         url "https://brew.sh/foo.tar.gz" | 
					
						
							| 
									
										
										
										
											2018-08-06 15:02:52 +02:00
										 |  |  |         version "1.0" | 
					
						
							|  |  |  |       end | 
					
						
							| 
									
										
										
										
											2023-03-08 23:14:46 +00:00
										 |  |  |     end | 
					
						
							| 
									
										
										
										
											2017-02-27 18:33:42 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-06 15:02:52 +02:00
										 |  |  |     its(:to_s) { is_expected.to eq "formula_name--1.0.tag.bottle.tar.gz" } | 
					
						
							| 
									
										
										
										
											2017-02-27 18:33:42 +01:00
										 |  |  |   end | 
					
						
							|  |  |  | end |