| 
									
										
										
										
											2020-11-30 18:11:17 -05:00
										 |  |  | # frozen_string_literal: true | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | require "rubocops/uses_from_macos" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | describe RuboCop::Cop::FormulaAudit::ProvidedByMacos do | 
					
						
							|  |  |  |   subject(:cop) { described_class.new } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-03 14:30:34 -05:00
										 |  |  |   it "fails for formulae not in PROVIDED_BY_MACOS_FORMULAE list" do | 
					
						
							|  |  |  |     expect_offense(<<~RUBY) | 
					
						
							| 
									
										
										
										
											2020-11-30 18:11:17 -05:00
										 |  |  |       class Baz < Formula | 
					
						
							|  |  |  |         url "https://brew.sh/baz-1.0.tgz" | 
					
						
							|  |  |  |         homepage "https://brew.sh" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         keg_only :provided_by_macos | 
					
						
							| 
									
										
										
										
											2023-04-07 17:16:48 +01:00
										 |  |  |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/ProvidedByMacos: Formulae that are `keg_only :provided_by_macos` should be added to the `PROVIDED_BY_MACOS_FORMULAE` list (in the Homebrew/brew repo) | 
					
						
							| 
									
										
										
										
											2020-11-30 18:11:17 -05:00
										 |  |  |       end | 
					
						
							|  |  |  |     RUBY | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-03 14:30:34 -05:00
										 |  |  |   it "succeeds for formulae in PROVIDED_BY_MACOS_FORMULAE list" do | 
					
						
							|  |  |  |     expect_no_offenses(<<~RUBY, "/homebrew-core/Formula/apr.rb") | 
					
						
							|  |  |  |       class Apr < Formula | 
					
						
							|  |  |  |         url "https://brew.sh/apr-1.0.tgz" | 
					
						
							| 
									
										
										
										
											2020-11-30 18:11:17 -05:00
										 |  |  |         homepage "https://brew.sh" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         keg_only :provided_by_macos | 
					
						
							|  |  |  |       end | 
					
						
							|  |  |  |     RUBY | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   it "succeeds for formulae that are keg_only for a different reason" do | 
					
						
							| 
									
										
										
										
											2020-12-03 14:30:34 -05:00
										 |  |  |     expect_no_offenses(<<~RUBY) | 
					
						
							|  |  |  |       class Foo < Formula | 
					
						
							| 
									
										
										
										
											2020-11-30 18:11:17 -05:00
										 |  |  |         url "https://brew.sh/foo-1.0.tgz" | 
					
						
							|  |  |  |         homepage "https://brew.sh" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         keg_only :versioned_formula | 
					
						
							|  |  |  |       end | 
					
						
							|  |  |  |     RUBY | 
					
						
							|  |  |  |   end | 
					
						
							| 
									
										
										
										
											2020-12-02 20:47:53 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  |   include_examples "formulae exist", described_class::PROVIDED_BY_MACOS_FORMULAE | 
					
						
							| 
									
										
										
										
											2020-11-30 18:11:17 -05:00
										 |  |  | end |