| 
									
										
										
										
											2021-01-31 14:50:29 -05:00
										 |  |  | # frozen_string_literal: true | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | require "rubocops/class" | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-02-18 15:11:11 -08:00
										 |  |  | RSpec.describe RuboCop::Cop::FormulaAuditStrict::TestPresent do | 
					
						
							| 
									
										
										
										
											2021-01-31 14:50:29 -05:00
										 |  |  |   subject(:cop) { described_class.new } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   it "reports an offense when there is no test block" do | 
					
						
							|  |  |  |     expect_offense(<<~RUBY) | 
					
						
							|  |  |  |       class Foo < Formula | 
					
						
							|  |  |  |       ^^^^^^^^^^^^^^^^^^^ A `test do` test block should be added | 
					
						
							|  |  |  |         url 'https://brew.sh/foo-1.0.tgz' | 
					
						
							|  |  |  |       end | 
					
						
							|  |  |  |     RUBY | 
					
						
							|  |  |  |   end | 
					
						
							| 
									
										
										
										
											2024-07-03 10:24:40 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |   it "reports no offenses when there is no test block and formula is disabled" do | 
					
						
							|  |  |  |     expect_no_offenses(<<~RUBY) | 
					
						
							|  |  |  |       class Foo < Formula | 
					
						
							|  |  |  |         url 'https://brew.sh/foo-1.0.tgz' | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         disable! date: "2024-07-03", because: :unsupported | 
					
						
							|  |  |  |       end | 
					
						
							|  |  |  |     RUBY | 
					
						
							|  |  |  |   end | 
					
						
							| 
									
										
										
										
											2021-01-31 14:50:29 -05:00
										 |  |  | end |