| 
									
										
										
										
											2016-07-16 21:03:12 +01:00
										 |  |  | require "testing_env" | 
					
						
							|  |  |  | require "fileutils" | 
					
						
							|  |  |  | require "pathname" | 
					
						
							|  |  |  | require "diagnostic" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class OSMacDiagnosticChecksTest < Homebrew::TestCase | 
					
						
							|  |  |  |   def setup | 
					
						
							| 
									
										
										
										
											2017-01-21 11:21:30 +00:00
										 |  |  |     super | 
					
						
							| 
									
										
										
										
											2016-07-16 21:03:12 +01:00
										 |  |  |     @checks = Homebrew::Diagnostic::Checks.new | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def test_check_for_other_package_managers | 
					
						
							|  |  |  |     MacOS.stubs(:macports_or_fink).returns ["fink"] | 
					
						
							|  |  |  |     assert_match "You have MacPorts or Fink installed:", | 
					
						
							|  |  |  |       @checks.check_for_other_package_managers | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-09-18 19:57:19 +01:00
										 |  |  |   def test_check_for_unsupported_macos | 
					
						
							| 
									
										
										
										
											2017-01-21 15:11:49 +00:00
										 |  |  |     ENV.delete("HOMEBREW_DEVELOPER") | 
					
						
							| 
									
										
										
										
											2016-07-16 21:03:12 +01:00
										 |  |  |     OS::Mac.stubs(:prerelease?).returns true | 
					
						
							|  |  |  |     assert_match "We do not provide support for this pre-release version.", | 
					
						
							| 
									
										
										
										
											2016-09-18 19:57:19 +01:00
										 |  |  |       @checks.check_for_unsupported_macos | 
					
						
							| 
									
										
										
										
											2016-07-16 21:03:12 +01:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def test_check_for_unsupported_curl_vars | 
					
						
							|  |  |  |     MacOS.stubs(:version).returns OS::Mac::Version.new("10.10") | 
					
						
							|  |  |  |     ENV["SSL_CERT_DIR"] = "/some/path" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     assert_match "SSL_CERT_DIR support was removed from Apple's curl.", | 
					
						
							|  |  |  |       @checks.check_for_unsupported_curl_vars | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def test_check_for_beta_xquartz | 
					
						
							|  |  |  |     MacOS::XQuartz.stubs(:version).returns("2.7.10_beta2") | 
					
						
							|  |  |  |     assert_match "The following beta release of XQuartz is installed: 2.7.10_beta2", @checks.check_for_beta_xquartz | 
					
						
							|  |  |  |   end | 
					
						
							| 
									
										
										
										
											2016-09-15 17:54:47 +10:00
										 |  |  | 
 | 
					
						
							|  |  |  |   def test_check_xcode_8_without_clt_on_el_capitan | 
					
						
							|  |  |  |     MacOS.stubs(:version).returns OS::Mac::Version.new("10.11") | 
					
						
							|  |  |  |     MacOS::Xcode.stubs(:installed?).returns true | 
					
						
							|  |  |  |     MacOS::Xcode.stubs(:version).returns "8.0" | 
					
						
							|  |  |  |     MacOS::Xcode.stubs(:without_clt?).returns true | 
					
						
							|  |  |  |     assert_match "You have Xcode 8 installed without the CLT", @checks.check_xcode_8_without_clt_on_el_capitan | 
					
						
							|  |  |  |   end | 
					
						
							| 
									
										
										
										
											2016-07-16 21:03:12 +01:00
										 |  |  | end |