| 
									
										
										
										
											2017-07-27 01:52:21 +05:30
										 |  |  | require "utils/svn" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | describe Utils do | 
					
						
							|  |  |  |   describe "#self.svn_available?" do | 
					
						
							| 
									
										
										
										
											2018-03-25 13:30:37 +01:00
										 |  |  |     before do | 
					
						
							| 
									
										
										
										
											2017-08-24 01:31:12 +05:30
										 |  |  |       described_class.clear_svn_version_cache | 
					
						
							| 
									
										
										
										
											2017-07-27 04:18:43 +05:30
										 |  |  |     end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-07-27 04:40:27 +05:30
										 |  |  |     it "returns svn version if svn available" do | 
					
						
							| 
									
										
										
										
											2017-09-25 17:21:11 -07:00
										 |  |  |       if File.executable? "/usr/bin/svn" | 
					
						
							| 
									
										
										
										
											2018-03-25 13:30:37 +01:00
										 |  |  |         expect(described_class).to be_svn_available | 
					
						
							| 
									
										
										
										
											2017-09-25 17:21:11 -07:00
										 |  |  |       else | 
					
						
							| 
									
										
										
										
											2018-03-25 13:30:37 +01:00
										 |  |  |         expect(described_class).not_to be_svn_available | 
					
						
							| 
									
										
										
										
											2017-09-25 17:21:11 -07:00
										 |  |  |       end | 
					
						
							| 
									
										
										
										
											2017-07-27 01:52:21 +05:30
										 |  |  |     end | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-14 16:55:45 -05:00
										 |  |  |   describe "#self.svn_remote_exists?" do | 
					
						
							| 
									
										
										
										
											2017-07-27 04:18:43 +05:30
										 |  |  |     it "returns true when svn is not available" do | 
					
						
							| 
									
										
										
										
											2018-03-25 13:30:37 +01:00
										 |  |  |       allow(described_class).to receive(:svn_available?).and_return(false) | 
					
						
							|  |  |  |       expect(described_class).to be_svn_remote_exists("blah") | 
					
						
							| 
									
										
										
										
											2017-07-27 01:52:21 +05:30
										 |  |  |     end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-07-27 04:40:27 +05:30
										 |  |  |     context "when svn is available" do | 
					
						
							|  |  |  |       before do | 
					
						
							| 
									
										
										
										
											2018-03-25 13:30:37 +01:00
										 |  |  |         allow(described_class).to receive(:svn_available?).and_return(true) | 
					
						
							| 
									
										
										
										
											2017-07-27 04:40:27 +05:30
										 |  |  |       end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       it "returns false when remote does not exist" do | 
					
						
							| 
									
										
										
										
											2018-03-25 13:30:37 +01:00
										 |  |  |         expect(described_class).not_to be_svn_remote_exists(HOMEBREW_CACHE/"install") | 
					
						
							| 
									
										
										
										
											2017-07-27 04:40:27 +05:30
										 |  |  |       end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-05 18:36:26 -08:00
										 |  |  |       it "returns true when remote exists", :needs_network, :needs_svn do | 
					
						
							| 
									
										
										
										
											2017-07-27 04:40:27 +05:30
										 |  |  |         remote = "http://github.com/Homebrew/install" | 
					
						
							|  |  |  |         svn = HOMEBREW_SHIMS_PATH/"scm/svn" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         HOMEBREW_CACHE.cd { system svn, "checkout", remote } | 
					
						
							| 
									
										
										
										
											2017-07-27 01:52:21 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-25 13:30:37 +01:00
										 |  |  |         expect(described_class).to be_svn_remote_exists(HOMEBREW_CACHE/"install") | 
					
						
							| 
									
										
										
										
											2017-07-27 04:40:27 +05:30
										 |  |  |       end | 
					
						
							| 
									
										
										
										
											2017-07-27 01:52:21 +05:30
										 |  |  |     end | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | end |